From 24e590d96567f4a69cba8bb88d9ff9dd675daf25 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Wed, 13 Nov 2019 21:55:58 -0800 Subject: [PATCH] Adding Attr, Decl, Expr, Stmt, and Type types for the full set of exposed kinds --- sources/ClangSharp/Cursors/Attrs/Attr.cs | 400 +++++++--- .../Cursors/Attrs/InheritableAttr.cs | 7 +- .../Cursors/Attrs/InheritableParamAttr.cs | 9 +- .../Cursors/Attrs/ParameterABIAttr.cs | 18 + sources/ClangSharp/Cursors/Attrs/StmtAttr.cs | 18 + sources/ClangSharp/Cursors/Attrs/TypeAttr.cs | 18 + sources/ClangSharp/Cursors/Cursor.cs | 4 +- .../Cursors/Decls/AccessSpecDecl.cs | 2 +- .../ClangSharp/Cursors/Decls/BindingDecl.cs | 13 + sources/ClangSharp/Cursors/Decls/BlockDecl.cs | 25 + .../Cursors/Decls/BuiltinTemplateDecl.cs | 13 + .../Cursors/Decls/CXXConstructorDecl.cs | 2 +- .../Cursors/Decls/CXXConversionDecl.cs | 2 +- .../Cursors/Decls/CXXDeductionGuideDecl.cs | 13 + .../Cursors/Decls/CXXDestructorDecl.cs | 2 +- .../ClangSharp/Cursors/Decls/CXXMethodDecl.cs | 9 +- .../ClangSharp/Cursors/Decls/CXXRecordDecl.cs | 11 +- .../ClangSharp/Cursors/Decls/CapturedDecl.cs | 25 + .../ClassScopeFunctionSpecializationDecl.cs | 13 + .../Cursors/Decls/ClassTemplateDecl.cs | 2 +- .../ClassTemplatePartialSpecializationDecl.cs | 2 +- .../Decls/ClassTemplateSpecializationDecl.cs | 29 +- .../ClangSharp/Cursors/Decls/ConceptDecl.cs | 13 + .../Decls/ConstructorUsingShadowDecl.cs | 13 + sources/ClangSharp/Cursors/Decls/Decl.cs | 348 +++------ .../Cursors/Decls/DeclaratorDecl.cs | 7 +- .../Cursors/Decls/DecompositionDecl.cs | 13 + sources/ClangSharp/Cursors/Decls/EmptyDecl.cs | 13 + .../Cursors/Decls/EnumConstantDecl.cs | 2 +- sources/ClangSharp/Cursors/Decls/EnumDecl.cs | 2 +- .../ClangSharp/Cursors/Decls/ExportDecl.cs | 25 + .../Cursors/Decls/ExternCContextDecl.cs | 25 + sources/ClangSharp/Cursors/Decls/FieldDecl.cs | 9 +- .../Cursors/Decls/FileScopeAsmDecl.cs | 13 + .../ClangSharp/Cursors/Decls/FriendDecl.cs | 2 +- .../Cursors/Decls/FriendTemplateDecl.cs | 13 + .../ClangSharp/Cursors/Decls/FunctionDecl.cs | 9 +- .../Cursors/Decls/FunctionTemplateDecl.cs | 2 +- .../Cursors/Decls/ImplicitParamDecl.cs | 13 + .../ClangSharp/Cursors/Decls/ImportDecl.cs | 2 +- .../Cursors/Decls/IndirectFieldDecl.cs | 13 + sources/ClangSharp/Cursors/Decls/LabelDecl.cs | 13 + .../Cursors/Decls/LinkageSpecDecl.cs | 9 +- .../Cursors/Decls/MSPropertyDecl.cs | 13 + sources/ClangSharp/Cursors/Decls/NamedDecl.cs | 7 +- .../Cursors/Decls/NamespaceAliasDecl.cs | 2 +- .../ClangSharp/Cursors/Decls/NamespaceDecl.cs | 2 +- .../Cursors/Decls/NonTypeTemplateParmDecl.cs | 2 +- .../Cursors/Decls/OMPAllocateDecl.cs | 13 + .../Cursors/Decls/OMPCapturedExprDecl.cs | 13 + .../Cursors/Decls/OMPDeclareMapperDecl.cs | 25 + .../Cursors/Decls/OMPDeclareReductionDecl.cs | 25 + .../Cursors/Decls/OMPRequiresDecl.cs | 13 + .../Cursors/Decls/OMPThreadPrivateDecl.cs | 13 + .../Cursors/Decls/ObjCAtDefsFieldDecl.cs | 13 + .../Cursors/Decls/ObjCCategoryDecl.cs | 2 +- .../Cursors/Decls/ObjCCategoryImplDecl.cs | 2 +- .../Cursors/Decls/ObjCCompatibleAliasDecl.cs | 13 + .../Cursors/Decls/ObjCContainerDecl.cs | 9 +- .../ClangSharp/Cursors/Decls/ObjCImplDecl.cs | 7 +- .../Cursors/Decls/ObjCImplementationDecl.cs | 2 +- .../Cursors/Decls/ObjCInterfaceDecl.cs | 2 +- .../ClangSharp/Cursors/Decls/ObjCIvarDecl.cs | 2 +- .../Cursors/Decls/ObjCMethodDecl.cs | 9 +- .../Cursors/Decls/ObjCPropertyDecl.cs | 2 +- .../Cursors/Decls/ObjCPropertyImplDecl.cs | 7 +- .../Cursors/Decls/ObjCProtocolDecl.cs | 2 +- .../Cursors/Decls/ObjCTypeParamDecl.cs | 13 + .../ClangSharp/Cursors/Decls/ParmVarDecl.cs | 2 +- .../Cursors/Decls/PragmaCommentDecl.cs | 13 + .../Cursors/Decls/PragmaDetectMismatchDecl.cs | 13 + .../ClangSharp/Cursors/Decls/RecordDecl.cs | 16 +- .../Cursors/Decls/RedeclarableTemplateDecl.cs | 7 +- .../Cursors/Decls/StaticAssertDecl.cs | 2 +- sources/ClangSharp/Cursors/Decls/TagDecl.cs | 7 +- .../ClangSharp/Cursors/Decls/TemplateDecl.cs | 7 +- .../Cursors/Decls/TemplateTemplateParmDecl.cs | 2 +- .../Cursors/Decls/TemplateTypeParmDecl.cs | 2 +- .../Cursors/Decls/TranslationUnitDecl.cs | 2 +- .../ClangSharp/Cursors/Decls/TypeAliasDecl.cs | 2 +- .../Cursors/Decls/TypeAliasTemplateDecl.cs | 2 +- sources/ClangSharp/Cursors/Decls/TypeDecl.cs | 7 +- .../ClangSharp/Cursors/Decls/TypedefDecl.cs | 2 +- .../Cursors/Decls/TypedefNameDecl.cs | 7 +- .../Decls/UnresolvedUsingTypenameDecl.cs | 13 + .../Cursors/Decls/UnresolvedUsingValueDecl.cs | 13 + sources/ClangSharp/Cursors/Decls/UsingDecl.cs | 2 +- .../Cursors/Decls/UsingDirectiveDecl.cs | 4 +- .../ClangSharp/Cursors/Decls/UsingPackDecl.cs | 13 + .../Cursors/Decls/UsingShadowDecl.cs | 22 + sources/ClangSharp/Cursors/Decls/ValueDecl.cs | 7 +- sources/ClangSharp/Cursors/Decls/VarDecl.cs | 9 +- .../Cursors/Decls/VarTemplateDecl.cs | 13 + .../VarTemplatePartialSpecializationDecl.cs | 13 + .../Decls/VarTemplateSpecializationDecl.cs | 22 + .../Exprs/AbstractConditionalOperator.cs | 7 +- .../ClangSharp/Cursors/Exprs/AddrLabelExpr.cs | 2 +- .../Cursors/Exprs/ArrayInitIndexExpr.cs | 13 + .../Cursors/Exprs/ArrayInitLoopExpr.cs | 13 + .../Cursors/Exprs/ArraySubscriptExpr.cs | 2 +- .../Cursors/Exprs/ArrayTypeTraitExpr.cs | 13 + .../ClangSharp/Cursors/Exprs/AsTypeExpr.cs | 13 + .../ClangSharp/Cursors/Exprs/AtomicExpr.cs | 13 + .../Exprs/BinaryConditionalOperator.cs | 13 + .../Cursors/Exprs/BinaryOperator.cs | 10 +- sources/ClangSharp/Cursors/Exprs/BlockExpr.cs | 2 +- .../Cursors/Exprs/BuiltinBitCastExpr.cs | 2 +- .../Cursors/Exprs/CStyleCastExpr.cs | 2 +- .../Cursors/Exprs/CUDAKernelCallExpr.cs | 13 + .../Cursors/Exprs/CXXBindTemporaryExpr.cs | 13 + .../Cursors/Exprs/CXXBoolLiteralExpr.cs | 2 +- .../Cursors/Exprs/CXXConstCastExpr.cs | 2 +- .../Cursors/Exprs/CXXConstructExpr.cs | 22 + .../Cursors/Exprs/CXXDefaultArgExpr.cs | 13 + .../Cursors/Exprs/CXXDefaultInitExpr.cs | 13 + .../ClangSharp/Cursors/Exprs/CXXDeleteExpr.cs | 2 +- .../Exprs/CXXDependentScopeMemberExpr.cs | 13 + .../Cursors/Exprs/CXXDynamicCastExpr.cs | 2 +- .../ClangSharp/Cursors/Exprs/CXXFoldExpr.cs | 13 + .../Cursors/Exprs/CXXFunctionalCastExpr.cs | 2 +- .../Cursors/Exprs/CXXInheritedCtorInitExpr.cs | 13 + .../Cursors/Exprs/CXXMemberCallExpr.cs | 13 + .../Cursors/Exprs/CXXNamedCastExpr.cs | 7 +- .../ClangSharp/Cursors/Exprs/CXXNewExpr.cs | 2 +- .../Cursors/Exprs/CXXNoexceptExpr.cs | 13 + .../Cursors/Exprs/CXXNullPtrLiteralExpr.cs | 2 +- .../Cursors/Exprs/CXXOperatorCallExpr.cs | 13 + .../Cursors/Exprs/CXXPseudoDestructorExpr.cs | 13 + .../Cursors/Exprs/CXXReinterpretCastExpr.cs | 2 +- .../Cursors/Exprs/CXXScalarValueInitExpr.cs | 13 + .../Cursors/Exprs/CXXStaticCastExpr.cs | 2 +- .../Exprs/CXXStdInitializerListExpr.cs | 13 + .../Cursors/Exprs/CXXTemporaryObjectExpr.cs | 13 + .../ClangSharp/Cursors/Exprs/CXXThisExpr.cs | 2 +- .../ClangSharp/Cursors/Exprs/CXXThrowExpr.cs | 2 +- .../ClangSharp/Cursors/Exprs/CXXTypeidExpr.cs | 2 +- .../Exprs/CXXUnresolvedConstructExpr.cs | 13 + .../ClangSharp/Cursors/Exprs/CXXUuidofExpr.cs | 13 + sources/ClangSharp/Cursors/Exprs/CallExpr.cs | 13 +- sources/ClangSharp/Cursors/Exprs/CastExpr.cs | 7 +- .../Cursors/Exprs/CharacterLiteral.cs | 2 +- .../ClangSharp/Cursors/Exprs/ChooseExpr.cs | 13 + .../ClangSharp/Cursors/Exprs/CoawaitExpr.cs | 13 + .../Cursors/Exprs/CompoundAssignOperator.cs | 2 +- .../Cursors/Exprs/CompoundLiteralExpr.cs | 2 +- .../Cursors/Exprs/ConditionalOperator.cs | 2 +- .../ClangSharp/Cursors/Exprs/ConstantExpr.cs | 13 + .../Cursors/Exprs/ConvertVectorExpr.cs | 13 + .../Cursors/Exprs/CoroutineSuspendExpr.cs | 18 + .../ClangSharp/Cursors/Exprs/CoyieldExpr.cs | 13 + .../ClangSharp/Cursors/Exprs/DeclRefExpr.cs | 7 +- .../Cursors/Exprs/DependentCoawaitExpr.cs | 13 + .../Exprs/DependentScopeDeclRefExpr.cs | 13 + .../Cursors/Exprs/DesignatedInitExpr.cs | 13 + .../Cursors/Exprs/DesignatedInitUpdateExpr.cs | 13 + .../Cursors/Exprs/ExplicitCastExpr.cs | 7 +- sources/ClangSharp/Cursors/Exprs/Expr.cs | 320 +------- .../Cursors/Exprs/ExprWithCleanups.cs | 13 + .../Cursors/Exprs/ExpressionTraitExpr.cs | 13 + .../Cursors/Exprs/ExtVectorElementExpr.cs | 13 + .../Cursors/Exprs/FixedPointLiteral.cs | 2 +- .../Cursors/Exprs/FloatingLiteral.cs | 2 +- sources/ClangSharp/Cursors/Exprs/FullExpr.cs | 18 + .../Cursors/Exprs/FunctionParmPackExpr.cs | 13 + .../ClangSharp/Cursors/Exprs/GNUNullExpr.cs | 2 +- .../Cursors/Exprs/GenericSelectionExpr.cs | 2 +- .../Cursors/Exprs/ImaginaryLiteral.cs | 2 +- .../Cursors/Exprs/ImplicitCastExpr.cs | 13 + .../Cursors/Exprs/ImplicitValueInitExpr.cs | 13 + .../ClangSharp/Cursors/Exprs/InitListExpr.cs | 2 +- .../Cursors/Exprs/IntegerLiteral.cs | 2 +- .../ClangSharp/Cursors/Exprs/LambdaExpr.cs | 2 +- .../Cursors/Exprs/MSPropertyRefExpr.cs | 13 + .../Cursors/Exprs/MSPropertySubscriptExpr.cs | 13 + .../Cursors/Exprs/MaterializeTemporaryExpr.cs | 13 + .../ClangSharp/Cursors/Exprs/MemberExpr.cs | 2 +- .../ClangSharp/Cursors/Exprs/NoInitExpr.cs | 13 + .../Cursors/Exprs/OMPArraySectionExpr.cs | 2 +- .../Cursors/Exprs/ObjCArrayLiteral.cs | 13 + .../Exprs/ObjCAvailabilityCheckExpr.cs | 2 +- .../Cursors/Exprs/ObjCBoolLiteralExpr.cs | 2 +- .../ClangSharp/Cursors/Exprs/ObjCBoxedExpr.cs | 13 + .../Cursors/Exprs/ObjCBridgedCastExpr.cs | 2 +- .../Cursors/Exprs/ObjCDictionaryLiteral.cs | 13 + .../Cursors/Exprs/ObjCEncodeExpr.cs | 2 +- .../Exprs/ObjCIndirectCopyRestoreExpr.cs | 13 + .../ClangSharp/Cursors/Exprs/ObjCIsaExpr.cs | 13 + .../Cursors/Exprs/ObjCIvarRefExpr.cs | 13 + .../Cursors/Exprs/ObjCMessageExpr.cs | 2 +- .../Cursors/Exprs/ObjCPropertyRefExpr.cs | 13 + .../Cursors/Exprs/ObjCProtocolExpr.cs | 2 +- .../Cursors/Exprs/ObjCSelectorExpr.cs | 2 +- .../Cursors/Exprs/ObjCStringLiteral.cs | 2 +- .../Cursors/Exprs/ObjCSubscriptRefExpr.cs | 13 + .../ClangSharp/Cursors/Exprs/OffsetOfExpr.cs | 13 + .../Cursors/Exprs/OpaqueValueExpr.cs | 13 + .../ClangSharp/Cursors/Exprs/OverloadExpr.cs | 18 + .../Cursors/Exprs/PackExpansionExpr.cs | 2 +- sources/ClangSharp/Cursors/Exprs/ParenExpr.cs | 2 +- .../ClangSharp/Cursors/Exprs/ParenListExpr.cs | 13 + .../Cursors/Exprs/PredefinedExpr.cs | 13 + .../Cursors/Exprs/PseudoObjectExpr.cs | 13 + .../Cursors/Exprs/ShuffleVectorExpr.cs | 13 + .../Cursors/Exprs/SizeOfPackExpr.cs | 2 +- .../ClangSharp/Cursors/Exprs/SourceLocExpr.cs | 13 + sources/ClangSharp/Cursors/Exprs/StmtExpr.cs | 2 +- .../ClangSharp/Cursors/Exprs/StringLiteral.cs | 2 +- .../Exprs/SubstNonTypeTemplateParmExpr.cs | 13 + .../Exprs/SubstNonTypeTemplateParmPackExpr.cs | 13 + .../ClangSharp/Cursors/Exprs/TypeTraitExpr.cs | 13 + sources/ClangSharp/Cursors/Exprs/TypoExpr.cs | 13 + .../Cursors/Exprs/UnaryExprOrTypeTraitExpr.cs | 2 +- .../ClangSharp/Cursors/Exprs/UnaryOperator.cs | 2 +- .../Cursors/Exprs/UnresolvedLookupExpr.cs | 13 + .../Cursors/Exprs/UnresolvedMemberExpr.cs | 13 + .../Cursors/Exprs/UserDefinedLiteral.cs | 13 + sources/ClangSharp/Cursors/Exprs/VAArgExpr.cs | 13 + .../Preprocessings/PreprocessedEntity.cs | 2 +- .../Preprocessings/PreprocessingDirective.cs | 2 +- sources/ClangSharp/Cursors/Refs/Ref.cs | 2 +- sources/ClangSharp/Cursors/Stmts/AsmStmt.cs | 7 +- .../Cursors/Stmts/AttributedStmt.cs | 13 + sources/ClangSharp/Cursors/Stmts/BreakStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/CXXCatchStmt.cs | 2 +- .../Cursors/Stmts/CXXForRangeStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/CXXTryStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/CapturedStmt.cs | 13 + sources/ClangSharp/Cursors/Stmts/CaseStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/CompoundStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/ContinueStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/CoreturnStmt.cs | 13 + .../Cursors/Stmts/CoroutineBodyStmt.cs | 13 + sources/ClangSharp/Cursors/Stmts/DeclStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/DefaultStmt.cs | 2 +- sources/ClangSharp/Cursors/Stmts/DoStmt.cs | 2 +- sources/ClangSharp/Cursors/Stmts/ForStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/GCCAsmStmt.cs | 2 +- sources/ClangSharp/Cursors/Stmts/GotoStmt.cs | 2 +- sources/ClangSharp/Cursors/Stmts/IfStmt.cs | 2 +- .../Cursors/Stmts/IndirectGotoStmt.cs | 2 +- sources/ClangSharp/Cursors/Stmts/LabelStmt.cs | 2 +- sources/ClangSharp/Cursors/Stmts/MSAsmStmt.cs | 2 +- .../Cursors/Stmts/MSDependentExistsStmt.cs | 13 + sources/ClangSharp/Cursors/Stmts/NullStmt.cs | 2 +- .../Cursors/Stmts/OMPAtomicDirective.cs | 2 +- .../Cursors/Stmts/OMPBarrierDirective.cs | 2 +- .../Cursors/Stmts/OMPCancelDirective.cs | 2 +- .../Stmts/OMPCancellationPointDirective.cs | 2 +- .../Cursors/Stmts/OMPCriticalDirective.cs | 2 +- .../Cursors/Stmts/OMPDistributeDirective.cs | 2 +- .../OMPDistributeParallelForDirective.cs | 2 +- .../OMPDistributeParallelForSimdDirective.cs | 2 +- .../Stmts/OMPDistributeSimdDirective.cs | 2 +- .../Cursors/Stmts/OMPExecutableDirective.cs | 7 +- .../Cursors/Stmts/OMPFlushDirective.cs | 2 +- .../Cursors/Stmts/OMPForDirective.cs | 2 +- .../Cursors/Stmts/OMPForSimdDirective.cs | 2 +- .../Cursors/Stmts/OMPLoopDirective.cs | 7 +- .../Cursors/Stmts/OMPMasterDirective.cs | 2 +- .../Cursors/Stmts/OMPOrderedDirective.cs | 2 +- .../Cursors/Stmts/OMPParallelDirective.cs | 2 +- .../Cursors/Stmts/OMPParallelForDirective.cs | 2 +- .../Stmts/OMPParallelForSimdDirective.cs | 2 +- .../Stmts/OMPParallelSectionsDirective.cs | 2 +- .../Cursors/Stmts/OMPSectionDirective.cs | 2 +- .../Cursors/Stmts/OMPSectionsDirective.cs | 2 +- .../Cursors/Stmts/OMPSimdDirective.cs | 2 +- .../Cursors/Stmts/OMPSingleDirective.cs | 2 +- .../Cursors/Stmts/OMPTargetDataDirective.cs | 2 +- .../Cursors/Stmts/OMPTargetDirective.cs | 2 +- .../Stmts/OMPTargetEnterDataDirective.cs | 2 +- .../Stmts/OMPTargetExitDataDirective.cs | 2 +- .../Stmts/OMPTargetParallelDirective.cs | 2 +- .../Stmts/OMPTargetParallelForDirective.cs | 2 +- .../OMPTargetParallelForSimdDirective.cs | 2 +- .../Cursors/Stmts/OMPTargetSimdDirective.cs | 2 +- .../Cursors/Stmts/OMPTargetTeamsDirective.cs | 2 +- .../OMPTargetTeamsDistributeDirective.cs | 2 +- ...rgetTeamsDistributeParallelForDirective.cs | 2 +- ...TeamsDistributeParallelForSimdDirective.cs | 2 +- .../OMPTargetTeamsDistributeSimdDirective.cs | 2 +- .../Cursors/Stmts/OMPTargetUpdateDirective.cs | 2 +- .../Cursors/Stmts/OMPTaskDirective.cs | 2 +- .../Cursors/Stmts/OMPTaskLoopDirective.cs | 2 +- .../Cursors/Stmts/OMPTaskLoopSimdDirective.cs | 2 +- .../Cursors/Stmts/OMPTaskgroupDirective.cs | 2 +- .../Cursors/Stmts/OMPTaskwaitDirective.cs | 2 +- .../Cursors/Stmts/OMPTaskyieldDirective.cs | 2 +- .../Cursors/Stmts/OMPTeamsDirective.cs | 2 +- .../Stmts/OMPTeamsDistributeDirective.cs | 2 +- .../OMPTeamsDistributeParallelForDirective.cs | 2 +- ...TeamsDistributeParallelForSimdDirective.cs | 2 +- .../Stmts/OMPTeamsDistributeSimdDirective.cs | 2 +- .../Cursors/Stmts/ObjCAtCatchStmt.cs | 2 +- .../Cursors/Stmts/ObjCAtFinallyStmt.cs | 2 +- .../Cursors/Stmts/ObjCAtSynchronizedStmt.cs | 2 +- .../Cursors/Stmts/ObjCAtThrowStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/ObjCAtTryStmt.cs | 2 +- .../Cursors/Stmts/ObjCAutoreleasePoolStmt.cs | 2 +- .../Cursors/Stmts/ObjCForCollectionStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/ReturnStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/SEHExceptStmt.cs | 2 +- .../Cursors/Stmts/SEHFinallyStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/SEHLeaveStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/SEHTryStmt.cs | 2 +- sources/ClangSharp/Cursors/Stmts/Stmt.cs | 712 +++++------------- .../ClangSharp/Cursors/Stmts/SwitchCase.cs | 7 +- .../ClangSharp/Cursors/Stmts/SwitchStmt.cs | 2 +- sources/ClangSharp/Cursors/Stmts/ValueStmt.cs | 7 +- sources/ClangSharp/Cursors/Stmts/WhileStmt.cs | 2 +- sources/ClangSharp/Types/AdjustedType.cs | 17 + sources/ClangSharp/Types/ArrayType.cs | 2 +- sources/ClangSharp/Types/AtomicType.cs | 13 + sources/ClangSharp/Types/AttributedType.cs | 2 +- .../DeclOrTypeAttr.cs => Types/AutoType.cs} | 4 +- sources/ClangSharp/Types/BlockPointerType.cs | 13 + sources/ClangSharp/Types/BuiltinType.cs | 2 +- sources/ClangSharp/Types/ComplexType.cs | 13 + sources/ClangSharp/Types/ConstantArrayType.cs | 2 +- sources/ClangSharp/Types/DecayedType.cs | 13 + sources/ClangSharp/Types/DecltypeType.cs | 13 + .../DeducedTemplateSpecializationType.cs | 13 + sources/ClangSharp/Types/DeducedType.cs | 13 + .../Types/DependentAddressSpaceType.cs | 13 + sources/ClangSharp/Types/DependentNameType.cs | 13 + .../Types/DependentSizedArrayType.cs | 2 +- .../Types/DependentSizedExtVectorType.cs | 13 + .../DependentTemplateSpecializationType.cs | 13 + .../ClangSharp/Types/DependentVectorType.cs | 13 + sources/ClangSharp/Types/ElaboratedType.cs | 2 +- sources/ClangSharp/Types/EnumType.cs | 2 +- sources/ClangSharp/Types/ExtVectorType.cs | 13 + .../ClangSharp/Types/FunctionNoProtoType.cs | 13 + sources/ClangSharp/Types/FunctionProtoType.cs | 2 +- sources/ClangSharp/Types/FunctionType.cs | 2 +- .../ClangSharp/Types/IncompleteArrayType.cs | 2 +- .../ClangSharp/Types/InjectedClassNameType.cs | 13 + .../ClangSharp/Types/LValueReferenceType.cs | 2 +- .../ClangSharp/Types/MacroQualifiedType.cs | 13 + sources/ClangSharp/Types/MemberPointerType.cs | 13 + sources/ClangSharp/Types/ObjCInterfaceType.cs | 13 + .../ClangSharp/Types/ObjCObjectPointerType.cs | 13 + sources/ClangSharp/Types/ObjCObjectType.cs | 17 + sources/ClangSharp/Types/ObjCTypeParamType.cs | 13 + sources/ClangSharp/Types/PackExpansionType.cs | 13 + sources/ClangSharp/Types/ParenType.cs | 13 + sources/ClangSharp/Types/PipeType.cs | 13 + sources/ClangSharp/Types/PointerType.cs | 2 +- .../ClangSharp/Types/RValueReferenceType.cs | 13 + sources/ClangSharp/Types/RecordType.cs | 2 +- sources/ClangSharp/Types/ReferenceType.cs | 2 +- .../Types/SubstTemplateTypeParmPackType.cs | 13 + .../Types/SubstTemplateTypeParmType.cs | 13 + sources/ClangSharp/Types/TagType.cs | 2 +- .../Types/TemplateSpecializationType.cs | 13 + .../ClangSharp/Types/TemplateTypeParmType.cs | 13 + sources/ClangSharp/Types/Type.cs | 172 ++--- sources/ClangSharp/Types/TypeOfExprType.cs | 13 + sources/ClangSharp/Types/TypeOfType.cs | 13 + sources/ClangSharp/Types/TypeWithKeyword.cs | 2 +- sources/ClangSharp/Types/TypedefType.cs | 2 +- .../ClangSharp/Types/UnaryTransformType.cs | 17 + .../ClangSharp/Types/UnresolvedUsingType.cs | 13 + sources/ClangSharp/Types/VariableArrayType.cs | 13 + sources/ClangSharp/Types/VectorType.cs | 17 + 365 files changed, 3152 insertions(+), 1529 deletions(-) create mode 100644 sources/ClangSharp/Cursors/Attrs/ParameterABIAttr.cs create mode 100644 sources/ClangSharp/Cursors/Attrs/StmtAttr.cs create mode 100644 sources/ClangSharp/Cursors/Attrs/TypeAttr.cs create mode 100644 sources/ClangSharp/Cursors/Decls/BindingDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/BlockDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/BuiltinTemplateDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/CXXDeductionGuideDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/CapturedDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/ClassScopeFunctionSpecializationDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/ConceptDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/ConstructorUsingShadowDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/DecompositionDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/EmptyDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/ExportDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/ExternCContextDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/FileScopeAsmDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/FriendTemplateDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/ImplicitParamDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/IndirectFieldDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/LabelDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/MSPropertyDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/OMPAllocateDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/OMPCapturedExprDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/OMPDeclareMapperDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/OMPDeclareReductionDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/OMPRequiresDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/OMPThreadPrivateDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/ObjCAtDefsFieldDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/ObjCCompatibleAliasDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/ObjCTypeParamDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/PragmaCommentDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/PragmaDetectMismatchDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/UnresolvedUsingTypenameDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/UnresolvedUsingValueDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/UsingPackDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/UsingShadowDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/VarTemplateDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/VarTemplatePartialSpecializationDecl.cs create mode 100644 sources/ClangSharp/Cursors/Decls/VarTemplateSpecializationDecl.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ArrayInitIndexExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ArrayInitLoopExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ArrayTypeTraitExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/AsTypeExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/AtomicExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/BinaryConditionalOperator.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CUDAKernelCallExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXBindTemporaryExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXConstructExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXDefaultArgExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXDefaultInitExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXDependentScopeMemberExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXFoldExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXInheritedCtorInitExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXMemberCallExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXNoexceptExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXOperatorCallExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXPseudoDestructorExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXScalarValueInitExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXStdInitializerListExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXTemporaryObjectExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXUnresolvedConstructExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CXXUuidofExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ChooseExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CoawaitExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ConstantExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ConvertVectorExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CoroutineSuspendExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/CoyieldExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/DependentCoawaitExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/DependentScopeDeclRefExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/DesignatedInitExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/DesignatedInitUpdateExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ExprWithCleanups.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ExpressionTraitExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ExtVectorElementExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/FullExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/FunctionParmPackExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ImplicitCastExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ImplicitValueInitExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/MSPropertyRefExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/MSPropertySubscriptExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/MaterializeTemporaryExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/NoInitExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ObjCArrayLiteral.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ObjCBoxedExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ObjCDictionaryLiteral.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ObjCIndirectCopyRestoreExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ObjCIsaExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ObjCIvarRefExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ObjCPropertyRefExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ObjCSubscriptRefExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/OffsetOfExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/OpaqueValueExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/OverloadExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ParenListExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/PredefinedExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/PseudoObjectExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/ShuffleVectorExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/SourceLocExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/SubstNonTypeTemplateParmExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/SubstNonTypeTemplateParmPackExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/TypeTraitExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/TypoExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/UnresolvedLookupExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/UnresolvedMemberExpr.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/UserDefinedLiteral.cs create mode 100644 sources/ClangSharp/Cursors/Exprs/VAArgExpr.cs create mode 100644 sources/ClangSharp/Cursors/Stmts/AttributedStmt.cs create mode 100644 sources/ClangSharp/Cursors/Stmts/CapturedStmt.cs create mode 100644 sources/ClangSharp/Cursors/Stmts/CoreturnStmt.cs create mode 100644 sources/ClangSharp/Cursors/Stmts/CoroutineBodyStmt.cs create mode 100644 sources/ClangSharp/Cursors/Stmts/MSDependentExistsStmt.cs create mode 100644 sources/ClangSharp/Types/AdjustedType.cs create mode 100644 sources/ClangSharp/Types/AtomicType.cs rename sources/ClangSharp/{Cursors/Attrs/DeclOrTypeAttr.cs => Types/AutoType.cs} (63%) create mode 100644 sources/ClangSharp/Types/BlockPointerType.cs create mode 100644 sources/ClangSharp/Types/ComplexType.cs create mode 100644 sources/ClangSharp/Types/DecayedType.cs create mode 100644 sources/ClangSharp/Types/DecltypeType.cs create mode 100644 sources/ClangSharp/Types/DeducedTemplateSpecializationType.cs create mode 100644 sources/ClangSharp/Types/DeducedType.cs create mode 100644 sources/ClangSharp/Types/DependentAddressSpaceType.cs create mode 100644 sources/ClangSharp/Types/DependentNameType.cs create mode 100644 sources/ClangSharp/Types/DependentSizedExtVectorType.cs create mode 100644 sources/ClangSharp/Types/DependentTemplateSpecializationType.cs create mode 100644 sources/ClangSharp/Types/DependentVectorType.cs create mode 100644 sources/ClangSharp/Types/ExtVectorType.cs create mode 100644 sources/ClangSharp/Types/FunctionNoProtoType.cs create mode 100644 sources/ClangSharp/Types/InjectedClassNameType.cs create mode 100644 sources/ClangSharp/Types/MacroQualifiedType.cs create mode 100644 sources/ClangSharp/Types/MemberPointerType.cs create mode 100644 sources/ClangSharp/Types/ObjCInterfaceType.cs create mode 100644 sources/ClangSharp/Types/ObjCObjectPointerType.cs create mode 100644 sources/ClangSharp/Types/ObjCObjectType.cs create mode 100644 sources/ClangSharp/Types/ObjCTypeParamType.cs create mode 100644 sources/ClangSharp/Types/PackExpansionType.cs create mode 100644 sources/ClangSharp/Types/ParenType.cs create mode 100644 sources/ClangSharp/Types/PipeType.cs create mode 100644 sources/ClangSharp/Types/RValueReferenceType.cs create mode 100644 sources/ClangSharp/Types/SubstTemplateTypeParmPackType.cs create mode 100644 sources/ClangSharp/Types/SubstTemplateTypeParmType.cs create mode 100644 sources/ClangSharp/Types/TemplateSpecializationType.cs create mode 100644 sources/ClangSharp/Types/TemplateTypeParmType.cs create mode 100644 sources/ClangSharp/Types/TypeOfExprType.cs create mode 100644 sources/ClangSharp/Types/TypeOfType.cs create mode 100644 sources/ClangSharp/Types/UnaryTransformType.cs create mode 100644 sources/ClangSharp/Types/UnresolvedUsingType.cs create mode 100644 sources/ClangSharp/Types/VariableArrayType.cs create mode 100644 sources/ClangSharp/Types/VectorType.cs diff --git a/sources/ClangSharp/Cursors/Attrs/Attr.cs b/sources/ClangSharp/Cursors/Attrs/Attr.cs index ad13feaf..21e3cc38 100644 --- a/sources/ClangSharp/Cursors/Attrs/Attr.cs +++ b/sources/ClangSharp/Cursors/Attrs/Attr.cs @@ -1,126 +1,306 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. -using System.Diagnostics; +using System; using ClangSharp.Interop; namespace ClangSharp { public class Attr : Cursor { - private protected Attr(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected Attr(CXCursor handle) : base(handle, handle.Kind) { - } - - internal static new Attr Create(CXCursor handle) - { - Attr result; - - switch (handle.Kind) + if (handle.AttrKind == CX_AttrKind.CX_AttrKind_Invalid) { - case CXCursorKind.CXCursor_UnexposedAttr: - { - result = new Attr(handle, CXCursorKind.CXCursor_UnexposedAttr); - break; - } - - case CXCursorKind.CXCursor_IBActionAttr: - case CXCursorKind.CXCursor_IBOutletAttr: - case CXCursorKind.CXCursor_IBOutletCollectionAttr: - case CXCursorKind.CXCursor_CXXFinalAttr: - case CXCursorKind.CXCursor_CXXOverrideAttr: - { - result = new InheritableAttr(handle, handle.Kind); - break; - } - - - case CXCursorKind.CXCursor_AnnotateAttr: - { - result = new InheritableParamAttr(handle, handle.Kind); - break; - } - - case CXCursorKind.CXCursor_AsmLabelAttr: - case CXCursorKind.CXCursor_PackedAttr: - case CXCursorKind.CXCursor_PureAttr: - case CXCursorKind.CXCursor_ConstAttr: - case CXCursorKind.CXCursor_NoDuplicateAttr: - case CXCursorKind.CXCursor_CUDAConstantAttr: - case CXCursorKind.CXCursor_CUDADeviceAttr: - case CXCursorKind.CXCursor_CUDAGlobalAttr: - case CXCursorKind.CXCursor_CUDAHostAttr: - case CXCursorKind.CXCursor_CUDASharedAttr: - case CXCursorKind.CXCursor_VisibilityAttr: - case CXCursorKind.CXCursor_DLLExport: - case CXCursorKind.CXCursor_DLLImport: - { - result = new InheritableAttr(handle, handle.Kind); - break; - } - - case CXCursorKind.CXCursor_NSReturnsRetained: - { - result = new DeclOrTypeAttr(handle, handle.Kind); - break; - } - - case CXCursorKind.CXCursor_NSReturnsNotRetained: - case CXCursorKind.CXCursor_NSReturnsAutoreleased: - case CXCursorKind.CXCursor_NSConsumesSelf: - { - result = new InheritableAttr(handle, handle.Kind); - break; - } - - case CXCursorKind.CXCursor_NSConsumed: - { - result = new InheritableParamAttr(handle, handle.Kind); - break; - } - - case CXCursorKind.CXCursor_ObjCException: - case CXCursorKind.CXCursor_ObjCNSObject: - case CXCursorKind.CXCursor_ObjCIndependentClass: - case CXCursorKind.CXCursor_ObjCPreciseLifetime: - case CXCursorKind.CXCursor_ObjCReturnsInnerPointer: - case CXCursorKind.CXCursor_ObjCRequiresSuper: - case CXCursorKind.CXCursor_ObjCRootClass: - case CXCursorKind.CXCursor_ObjCSubclassingRestricted: - case CXCursorKind.CXCursor_ObjCExplicitProtocolImpl: - { - result = new InheritableAttr(handle, handle.Kind); - break; - } - - case CXCursorKind.CXCursor_ObjCDesignatedInitializer: - case CXCursorKind.CXCursor_ObjCRuntimeVisible: - case CXCursorKind.CXCursor_ObjCBoxable: - { - result = new Attr(handle, handle.Kind); - break; - } - - case CXCursorKind.CXCursor_FlagEnum: - case CXCursorKind.CXCursor_ConvergentAttr: - case CXCursorKind.CXCursor_WarnUnusedAttr: - case CXCursorKind.CXCursor_WarnUnusedResultAttr: - case CXCursorKind.CXCursor_AlignedAttr: - { - result = new InheritableAttr(handle, handle.Kind); - break; - } - - default: - { - Debug.WriteLine($"Unhandled attribute kind: {handle.KindSpelling}."); - result = new Attr(handle, handle.kind); - break; - } + throw new ArgumentException(nameof(handle)); } - - return result; } + internal static new Attr Create(CXCursor handle) => handle.AttrKind switch + { + CX_AttrKind.CX_AttrKind_AddressSpace => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_NoDeref => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCGC => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCInertUnsafeUnretained => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCKindOf => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_OpenCLConstantAddressSpace => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_OpenCLGenericAddressSpace => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_OpenCLGlobalAddressSpace => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_OpenCLLocalAddressSpace => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_OpenCLPrivateAddressSpace => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_Ptr32 => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_Ptr64 => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_SPtr => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_TypeNonNull => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_TypeNullUnspecified => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_TypeNullable => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_UPtr => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_FallThrough => new StmtAttr(handle), + CX_AttrKind.CX_AttrKind_Suppress => new StmtAttr(handle), + CX_AttrKind.CX_AttrKind_AArch64VectorPcs => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AnyX86NoCfCheck => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CDecl => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_FastCall => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_IntelOclBicc => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_LifetimeBound => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MSABI => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NSReturnsRetained => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCOwnership => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Pascal => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Pcs => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_PreserveAll => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_PreserveMost => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_RegCall => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_StdCall => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_SwiftCall => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_SysVABI => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ThisCall => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_VectorCall => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_SwiftContext => new ParameterABIAttr(handle), + CX_AttrKind.CX_AttrKind_SwiftErrorResult => new ParameterABIAttr(handle), + CX_AttrKind.CX_AttrKind_SwiftIndirectResult => new ParameterABIAttr(handle), + CX_AttrKind.CX_AttrKind_Annotate => new InheritableParamAttr(handle), + CX_AttrKind.CX_AttrKind_CFConsumed => new InheritableParamAttr(handle), + CX_AttrKind.CX_AttrKind_CarriesDependency => new InheritableParamAttr(handle), + CX_AttrKind.CX_AttrKind_NSConsumed => new InheritableParamAttr(handle), + CX_AttrKind.CX_AttrKind_NonNull => new InheritableParamAttr(handle), + CX_AttrKind.CX_AttrKind_OSConsumed => new InheritableParamAttr(handle), + CX_AttrKind.CX_AttrKind_PassObjectSize => new InheritableParamAttr(handle), + CX_AttrKind.CX_AttrKind_AMDGPUFlatWorkGroupSize => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AMDGPUNumSGPR => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AMDGPUNumVGPR => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AMDGPUWavesPerEU => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ARMInterrupt => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AVRInterrupt => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AVRSignal => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AcquireCapability => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AcquiredAfter => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AcquiredBefore => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AlignMac68k => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Aligned => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AllocAlign => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AllocSize => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AlwaysDestroy => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AlwaysInline => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AnalyzerNoReturn => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AnyX86Interrupt => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AnyX86NoCallerSavedRegisters => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ArcWeakrefUnavailable => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ArgumentWithTypeTag => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Artificial => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AsmLabel => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AssertCapability => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AssertExclusiveLock => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AssertSharedLock => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AssumeAligned => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Availability => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Blocks => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_C11NoReturn => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CFAuditedTransfer => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CFReturnsNotRetained => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CFReturnsRetained => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CFUnknownTransfer => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CPUDispatch => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CPUSpecific => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CUDAConstant => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CUDADevice => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CUDAGlobal => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CUDAHost => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CUDAInvalidTarget => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CUDALaunchBounds => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CUDAShared => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CXX11NoReturn => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CallableWhen => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Callback => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Capability => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CapturedRecord => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Cleanup => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_CodeSeg => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Cold => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Common => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Const => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Constructor => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Consumable => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ConsumableAutoCast => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ConsumableSetOnRead => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Convergent => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_DLLExport => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_DLLExportStaticLocal => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_DLLImport => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_DLLImportStaticLocal => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Deprecated => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Destructor => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_DiagnoseIf => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_DisableTailCalls => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_EmptyBases => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_EnableIf => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_EnumExtensibility => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ExcludeFromExplicitInstantiation => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ExclusiveTrylockFunction => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ExternalSourceSymbol => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Final => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_FlagEnum => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Flatten => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Format => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_FormatArg => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_GNUInline => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_GuardedBy => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_GuardedVar => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_HIPPinnedShadow => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Hot => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_IBAction => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_IBOutlet => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_IBOutletCollection => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_InitPriority => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_InternalLinkage => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_LTOVisibilityPublic => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_LayoutVersion => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_LockReturned => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_LocksExcluded => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MIGServerRoutine => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MSAllocator => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MSInheritance => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MSNoVTable => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MSP430Interrupt => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MSStruct => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MSVtorDisp => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MaxFieldAlignment => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MayAlias => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MicroMips => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MinSize => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MinVectorWidth => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Mips16 => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MipsInterrupt => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MipsLongCall => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_MipsShortCall => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NSConsumesSelf => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NSReturnsAutoreleased => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NSReturnsNotRetained => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Naked => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoAlias => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoCommon => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoDebug => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoDestroy => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoDuplicate => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoInline => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoInstrumentFunction => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoMicroMips => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoMips16 => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoReturn => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoSanitize => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoSpeculativeLoadHardening => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoSplitStack => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoStackProtector => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoThreadSafetyAnalysis => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoThrow => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoUniqueAddress => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NotTailCalled => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_OMPAllocateDecl => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_OMPCaptureNoInit => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_OMPDeclareTargetDecl => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_OMPThreadPrivateDecl => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_OSConsumesThis => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_OSReturnsNotRetained => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_OSReturnsRetained => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_OSReturnsRetainedOnNonZero => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_OSReturnsRetainedOnZero => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCBridge => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCBridgeMutable => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCBridgeRelated => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCException => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCExplicitProtocolImpl => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCExternallyRetained => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCIndependentClass => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCMethodFamily => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCNSObject => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCPreciseLifetime => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCRequiresPropertyDefs => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCRequiresSuper => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCReturnsInnerPointer => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCRootClass => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ObjCSubclassingRestricted => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_OpenCLIntelReqdSubGroupSize => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_OpenCLKernel => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_OpenCLUnrollHint => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_OptimizeNone => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Override => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Ownership => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Packed => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ParamTypestate => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_PragmaClangBSSSection => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_PragmaClangDataSection => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_PragmaClangRodataSection => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_PragmaClangTextSection => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_PtGuardedBy => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_PtGuardedVar => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Pure => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_RISCVInterrupt => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Reinitializes => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ReleaseCapability => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ReqdWorkGroupSize => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_RequireConstantInit => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_RequiresCapability => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Restrict => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ReturnTypestate => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ReturnsNonNull => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ReturnsTwice => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ScopedLockable => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Section => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_SelectAny => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Sentinel => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_SetTypestate => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_SharedTrylockFunction => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_SpeculativeLoadHardening => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_TLSModel => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Target => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_TestTypestate => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_TransparentUnion => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_TrivialABI => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_TryAcquireCapability => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_TypeTagForDatatype => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_TypeVisibility => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Unavailable => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Uninitialized => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Unused => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Used => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Uuid => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_VecReturn => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_VecTypeHint => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Visibility => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_WarnUnused => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_WarnUnusedResult => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_Weak => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_WeakImport => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_WeakRef => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_WebAssemblyImportModule => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_WebAssemblyImportName => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_WorkGroupSizeHint => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_X86ForceAlignArgPointer => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_XRayInstrument => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_XRayLogArgs => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AbiTag => new Attr(handle), + CX_AttrKind.CX_AttrKind_Alias => new Attr(handle), + CX_AttrKind.CX_AttrKind_AlignValue => new Attr(handle), + CX_AttrKind.CX_AttrKind_IFunc => new Attr(handle), + CX_AttrKind.CX_AttrKind_InitSeg => new Attr(handle), + CX_AttrKind.CX_AttrKind_LoopHint => new Attr(handle), + CX_AttrKind.CX_AttrKind_Mode => new Attr(handle), + CX_AttrKind.CX_AttrKind_NoEscape => new Attr(handle), + CX_AttrKind.CX_AttrKind_OMPCaptureKind => new Attr(handle), + CX_AttrKind.CX_AttrKind_OMPDeclareSimdDecl => new Attr(handle), + CX_AttrKind.CX_AttrKind_OMPReferencedVar => new Attr(handle), + CX_AttrKind.CX_AttrKind_ObjCBoxable => new Attr(handle), + CX_AttrKind.CX_AttrKind_ObjCClassStub => new Attr(handle), + CX_AttrKind.CX_AttrKind_ObjCDesignatedInitializer => new Attr(handle), + CX_AttrKind.CX_AttrKind_ObjCNonLazyClass => new Attr(handle), + CX_AttrKind.CX_AttrKind_ObjCRuntimeName => new Attr(handle), + CX_AttrKind.CX_AttrKind_ObjCRuntimeVisible => new Attr(handle), + CX_AttrKind.CX_AttrKind_OpenCLAccess => new Attr(handle), + CX_AttrKind.CX_AttrKind_Overloadable => new Attr(handle), + CX_AttrKind.CX_AttrKind_RenderScriptKernel => new Attr(handle), + CX_AttrKind.CX_AttrKind_Thread => new Attr(handle), + _ => new Attr(handle), + }; + public CX_AttrKind Kind => Handle.AttrKind; } } diff --git a/sources/ClangSharp/Cursors/Attrs/InheritableAttr.cs b/sources/ClangSharp/Cursors/Attrs/InheritableAttr.cs index 1fff50e6..4902aca4 100644 --- a/sources/ClangSharp/Cursors/Attrs/InheritableAttr.cs +++ b/sources/ClangSharp/Cursors/Attrs/InheritableAttr.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class InheritableAttr : Attr { - internal InheritableAttr(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + internal InheritableAttr(CXCursor handle) : base(handle) { + if ((CX_AttrKind.CX_AttrKind_LastInheritableAttr < handle.AttrKind) || (handle.AttrKind < CX_AttrKind.CX_AttrKind_FirstInheritableAttr)) + { + throw new ArgumentException(nameof(handle)); + } } } } diff --git a/sources/ClangSharp/Cursors/Attrs/InheritableParamAttr.cs b/sources/ClangSharp/Cursors/Attrs/InheritableParamAttr.cs index 3d97116b..169333fa 100644 --- a/sources/ClangSharp/Cursors/Attrs/InheritableParamAttr.cs +++ b/sources/ClangSharp/Cursors/Attrs/InheritableParamAttr.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { - public sealed class InheritableParamAttr : InheritableAttr + public class InheritableParamAttr : InheritableAttr { - internal InheritableParamAttr(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + internal InheritableParamAttr(CXCursor handle) : base(handle) { + if ((CX_AttrKind.CX_AttrKind_LastInheritableParamAttr < handle.AttrKind) || (handle.AttrKind < CX_AttrKind.CX_AttrKind_FirstInheritableParamAttr)) + { + throw new ArgumentException(nameof(handle)); + } } } } diff --git a/sources/ClangSharp/Cursors/Attrs/ParameterABIAttr.cs b/sources/ClangSharp/Cursors/Attrs/ParameterABIAttr.cs new file mode 100644 index 00000000..ebc4ecda --- /dev/null +++ b/sources/ClangSharp/Cursors/Attrs/ParameterABIAttr.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using System; +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ParameterABIAttr : InheritableParamAttr + { + internal ParameterABIAttr(CXCursor handle) : base(handle) + { + if ((CX_AttrKind.CX_AttrKind_LastParameterABIAttr < handle.AttrKind) || (handle.AttrKind < CX_AttrKind.CX_AttrKind_FirstParameterABIAttr)) + { + throw new ArgumentException(nameof(handle)); + } + } + } +} diff --git a/sources/ClangSharp/Cursors/Attrs/StmtAttr.cs b/sources/ClangSharp/Cursors/Attrs/StmtAttr.cs new file mode 100644 index 00000000..a2bcf390 --- /dev/null +++ b/sources/ClangSharp/Cursors/Attrs/StmtAttr.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using System; +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class StmtAttr : Attr + { + internal StmtAttr(CXCursor handle) : base(handle) + { + if ((CX_AttrKind.CX_AttrKind_LastStmtAttr < handle.AttrKind) || (handle.AttrKind < CX_AttrKind.CX_AttrKind_FirstStmtAttr)) + { + throw new ArgumentException(nameof(handle)); + } + } + } +} diff --git a/sources/ClangSharp/Cursors/Attrs/TypeAttr.cs b/sources/ClangSharp/Cursors/Attrs/TypeAttr.cs new file mode 100644 index 00000000..1f53cb66 --- /dev/null +++ b/sources/ClangSharp/Cursors/Attrs/TypeAttr.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using System; +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class TypeAttr : Attr + { + internal TypeAttr(CXCursor handle) : base(handle) + { + if ((CX_AttrKind.CX_AttrKind_LastTypeAttr < handle.AttrKind) || (handle.AttrKind < CX_AttrKind.CX_AttrKind_FirstTypeAttr)) + { + throw new ArgumentException(nameof(handle)); + } + } + } +} diff --git a/sources/ClangSharp/Cursors/Cursor.cs b/sources/ClangSharp/Cursors/Cursor.cs index fe4bb447..7f61a13b 100644 --- a/sources/ClangSharp/Cursors/Cursor.cs +++ b/sources/ClangSharp/Cursors/Cursor.cs @@ -12,9 +12,9 @@ public unsafe class Cursor : IEquatable private readonly Lazy> _cursorChildren; private readonly Lazy _translationUnit; - private protected Cursor(CXCursor handle, CXCursorKind expectedKind) + private protected Cursor(CXCursor handle, CXCursorKind expectedCursorKind) { - if (handle.kind != expectedKind) + if (handle.kind != expectedCursorKind) { throw new ArgumentException(nameof(handle)); } diff --git a/sources/ClangSharp/Cursors/Decls/AccessSpecDecl.cs b/sources/ClangSharp/Cursors/Decls/AccessSpecDecl.cs index 886a6677..a4f05265 100644 --- a/sources/ClangSharp/Cursors/Decls/AccessSpecDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/AccessSpecDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class AccessSpecDecl : Decl { - internal AccessSpecDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXAccessSpecifier) + internal AccessSpecDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXAccessSpecifier, CX_DeclKind.CX_DeclKind_AccessSpec) { } } diff --git a/sources/ClangSharp/Cursors/Decls/BindingDecl.cs b/sources/ClangSharp/Cursors/Decls/BindingDecl.cs new file mode 100644 index 00000000..04853fcd --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/BindingDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class BindingDecl : ValueDecl + { + internal BindingDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_Binding) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/BlockDecl.cs b/sources/ClangSharp/Cursors/Decls/BlockDecl.cs new file mode 100644 index 00000000..efcbb93a --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/BlockDecl.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace ClangSharp +{ + public sealed class BlockDecl : Decl, IDeclContext + { + private readonly Lazy> _decls; + + internal BlockDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_Block) + { + _decls = new Lazy>(() => CursorChildren.OfType().ToList()); + } + + public IReadOnlyList Decls => _decls.Value; + + public IDeclContext LexicalParent => LexicalDeclContext; + + public IDeclContext Parent => DeclContext; + } +} diff --git a/sources/ClangSharp/Cursors/Decls/BuiltinTemplateDecl.cs b/sources/ClangSharp/Cursors/Decls/BuiltinTemplateDecl.cs new file mode 100644 index 00000000..15bf8e68 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/BuiltinTemplateDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class BuiltinTemplateDecl : TemplateDecl + { + internal BuiltinTemplateDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_BuiltinTemplate) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/CXXConstructorDecl.cs b/sources/ClangSharp/Cursors/Decls/CXXConstructorDecl.cs index 7b0ae760..f4ba0e91 100644 --- a/sources/ClangSharp/Cursors/Decls/CXXConstructorDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/CXXConstructorDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXConstructorDecl : CXXMethodDecl { - internal CXXConstructorDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Constructor) + internal CXXConstructorDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Constructor, CX_DeclKind.CX_DeclKind_CXXConstructor) { } diff --git a/sources/ClangSharp/Cursors/Decls/CXXConversionDecl.cs b/sources/ClangSharp/Cursors/Decls/CXXConversionDecl.cs index 5d6a3ec3..7376a4ad 100644 --- a/sources/ClangSharp/Cursors/Decls/CXXConversionDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/CXXConversionDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXConversionDecl : CXXMethodDecl { - internal CXXConversionDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ConversionFunction) + internal CXXConversionDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ConversionFunction, CX_DeclKind.CX_DeclKind_CXXConversion) { } } diff --git a/sources/ClangSharp/Cursors/Decls/CXXDeductionGuideDecl.cs b/sources/ClangSharp/Cursors/Decls/CXXDeductionGuideDecl.cs new file mode 100644 index 00000000..3cf9a5e5 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/CXXDeductionGuideDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXDeductionGuideDecl : FunctionDecl + { + internal CXXDeductionGuideDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_CXXDeductionGuide) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/CXXDestructorDecl.cs b/sources/ClangSharp/Cursors/Decls/CXXDestructorDecl.cs index 9dd5c16f..0f58e376 100644 --- a/sources/ClangSharp/Cursors/Decls/CXXDestructorDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/CXXDestructorDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXDestructorDecl : CXXMethodDecl { - internal CXXDestructorDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Destructor) + internal CXXDestructorDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Destructor, CX_DeclKind.CX_DeclKind_CXXDestructor) { } } diff --git a/sources/ClangSharp/Cursors/Decls/CXXMethodDecl.cs b/sources/ClangSharp/Cursors/Decls/CXXMethodDecl.cs index 211194f2..8534c9ad 100644 --- a/sources/ClangSharp/Cursors/Decls/CXXMethodDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/CXXMethodDecl.cs @@ -1,17 +1,22 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class CXXMethodDecl : FunctionDecl { - internal CXXMethodDecl(CXCursor handle) : this(handle, CXCursorKind.CXCursor_CXXMethod) + internal CXXMethodDecl(CXCursor handle) : this(handle, CXCursorKind.CXCursor_CXXMethod, CX_DeclKind.CX_DeclKind_CXXMethod) { } - private protected CXXMethodDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected CXXMethodDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { + if ((CX_DeclKind.CX_DeclKind_LastCXXMethod < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstCXXMethod)) + { + throw new ArgumentException(nameof(handle)); + } } public bool IsConst => Handle.CXXMethod_IsConst; diff --git a/sources/ClangSharp/Cursors/Decls/CXXRecordDecl.cs b/sources/ClangSharp/Cursors/Decls/CXXRecordDecl.cs index 9ebbedd9..e2c493c3 100644 --- a/sources/ClangSharp/Cursors/Decls/CXXRecordDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/CXXRecordDecl.cs @@ -16,8 +16,17 @@ public class CXXRecordDecl : RecordDecl private readonly Lazy> _methods; private readonly Lazy> _vbases; - internal CXXRecordDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + internal CXXRecordDecl(CXCursor handle) : this(handle, handle.Kind, CX_DeclKind.CX_DeclKind_CXXRecord) { + } + + private protected CXXRecordDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) + { + if ((CX_DeclKind.CX_DeclKind_LastCXXRecord < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstCXXRecord)) + { + throw new ArgumentException(nameof(handle)); + } + _bases = new Lazy>(() => CursorChildren.OfType().ToList()); _ctors = new Lazy>(() => Methods.OfType().ToList()); _destructor = new Lazy(() => Methods.OfType().SingleOrDefault()); diff --git a/sources/ClangSharp/Cursors/Decls/CapturedDecl.cs b/sources/ClangSharp/Cursors/Decls/CapturedDecl.cs new file mode 100644 index 00000000..a56f2d6b --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/CapturedDecl.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace ClangSharp +{ + public sealed class CapturedDecl : Decl, IDeclContext + { + private readonly Lazy> _decls; + + internal CapturedDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_Captured) + { + _decls = new Lazy>(() => CursorChildren.OfType().ToList()); + } + + public IReadOnlyList Decls => _decls.Value; + + public IDeclContext LexicalParent => LexicalDeclContext; + + public IDeclContext Parent => DeclContext; + } +} diff --git a/sources/ClangSharp/Cursors/Decls/ClassScopeFunctionSpecializationDecl.cs b/sources/ClangSharp/Cursors/Decls/ClassScopeFunctionSpecializationDecl.cs new file mode 100644 index 00000000..7da6b766 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/ClassScopeFunctionSpecializationDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ClassScopeFunctionSpecializationDecl : Decl + { + internal ClassScopeFunctionSpecializationDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_ClassScopeFunctionSpecialization) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/ClassTemplateDecl.cs b/sources/ClangSharp/Cursors/Decls/ClassTemplateDecl.cs index 984d8200..22ac3384 100644 --- a/sources/ClangSharp/Cursors/Decls/ClassTemplateDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ClassTemplateDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ClassTemplateDecl : RedeclarableTemplateDecl { - internal ClassTemplateDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ClassTemplate) + internal ClassTemplateDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ClassTemplate, CX_DeclKind.CX_DeclKind_ClassTemplate) { } } diff --git a/sources/ClangSharp/Cursors/Decls/ClassTemplatePartialSpecializationDecl.cs b/sources/ClangSharp/Cursors/Decls/ClassTemplatePartialSpecializationDecl.cs index 411181fe..e3d82dc1 100644 --- a/sources/ClangSharp/Cursors/Decls/ClassTemplatePartialSpecializationDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ClassTemplatePartialSpecializationDecl.cs @@ -11,7 +11,7 @@ public sealed class ClassTemplatePartialSpecializationDecl : ClassTemplateSpecia { private readonly Lazy> _templateParameters; - internal ClassTemplatePartialSpecializationDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ClassTemplatePartialSpecialization) + internal ClassTemplatePartialSpecializationDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ClassTemplatePartialSpecialization, CX_DeclKind.CX_DeclKind_ClassTemplatePartialSpecialization) { _templateParameters = new Lazy>(() => CursorChildren.Where((cursor) => (cursor is TemplateTypeParmDecl) || (cursor is NonTypeTemplateParmDecl) || (cursor is TemplateTemplateParmDecl)).Cast().ToList()); } diff --git a/sources/ClangSharp/Cursors/Decls/ClassTemplateSpecializationDecl.cs b/sources/ClangSharp/Cursors/Decls/ClassTemplateSpecializationDecl.cs index 0bf1c2c6..d6714c24 100644 --- a/sources/ClangSharp/Cursors/Decls/ClassTemplateSpecializationDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ClassTemplateSpecializationDecl.cs @@ -2,18 +2,45 @@ using ClangSharp.Interop; using System; +using System.Collections.Generic; namespace ClangSharp { public class ClassTemplateSpecializationDecl : CXXRecordDecl { private readonly Lazy _specializedTemplate; + private readonly Lazy> _templateArgs; - private protected ClassTemplateSpecializationDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + internal ClassTemplateSpecializationDecl(CXCursor handle) : this(handle, handle.Kind, CX_DeclKind.CX_DeclKind_ClassTemplateSpecialization) { + } + + private protected ClassTemplateSpecializationDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) + { + if ((CX_DeclKind.CX_DeclKind_LastClassTemplateSpecialization < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstClassTemplateSpecialization)) + { + throw new ArgumentException(nameof(handle)); + } + _specializedTemplate = new Lazy(() => TranslationUnit.GetOrCreate(Handle.SpecializedCursorTemplate)); + _templateArgs = new Lazy>(() => { + var templateArgsSize = TemplateArgsSize; + var templateArgs = new List(templateArgsSize); + + for (var index = 0; index < templateArgsSize; index++) + { + var templateArg = TypeForDecl.Handle.GetTemplateArgumentAsType((uint)index); + templateArgs.Add(TranslationUnit.GetOrCreate(templateArg)); + } + + return templateArgs; + }); } + public IReadOnlyList TemplateArgs => _templateArgs.Value; + + public int TemplateArgsSize => TypeForDecl.Handle.NumTemplateArguments; + public ClassTemplateDecl SpecializedTemplate => _specializedTemplate.Value; } } diff --git a/sources/ClangSharp/Cursors/Decls/ConceptDecl.cs b/sources/ClangSharp/Cursors/Decls/ConceptDecl.cs new file mode 100644 index 00000000..b58a8b81 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/ConceptDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ConceptDecl : TemplateDecl, IMergeable + { + internal ConceptDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_Concept) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/ConstructorUsingShadowDecl.cs b/sources/ClangSharp/Cursors/Decls/ConstructorUsingShadowDecl.cs new file mode 100644 index 00000000..c30917d3 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/ConstructorUsingShadowDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ConstructorUsingShadowDecl : UsingShadowDecl + { + internal ConstructorUsingShadowDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_ConstructorUsingShadow) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/Decl.cs b/sources/ClangSharp/Cursors/Decls/Decl.cs index 97f29795..963fe466 100644 --- a/sources/ClangSharp/Cursors/Decls/Decl.cs +++ b/sources/ClangSharp/Cursors/Decls/Decl.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using ClangSharp.Interop; @@ -16,8 +15,13 @@ public class Decl : Cursor private readonly Lazy _lexicalDeclContext; private readonly Lazy _translationUnitDecl; - private protected Decl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected Decl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind) { + if ((handle.DeclKind == CX_DeclKind.CX_DeclKind_Invalid) || (handle.DeclKind != expectedDeclKind)) + { + throw new ArgumentException(nameof(handle)); + } + _attrs = new Lazy>(() => CursorChildren.OfType().ToList()); _canonicalDecl = new Lazy(() => TranslationUnit.GetOrCreate(Handle.CanonicalCursor)); _declContext = new Lazy(() => TranslationUnit.GetOrCreate(Handle.SemanticParent) as IDeclContext); @@ -47,266 +51,86 @@ private protected Decl(CXCursor handle, CXCursorKind expectedKind) : base(handle public TranslationUnitDecl TranslationUnitDecl => _translationUnitDecl.Value; - internal static new Decl Create(CXCursor handle) + internal static new Decl Create(CXCursor handle) => handle.DeclKind switch { - Decl result; - - switch (handle.Kind) - { - case CXCursorKind.CXCursor_UnexposedDecl: - { - result = new Decl(handle, handle.Kind); - break; - } - - case CXCursorKind.CXCursor_StructDecl: - case CXCursorKind.CXCursor_UnionDecl: - case CXCursorKind.CXCursor_ClassDecl: - { - if (handle.Language == CXLanguageKind.CXLanguage_CPlusPlus) - { - result = new CXXRecordDecl(handle, handle.Kind); - } - else - { - result = new RecordDecl(handle, handle.Kind); - } - break; - } - - case CXCursorKind.CXCursor_EnumDecl: - { - result = new EnumDecl(handle); - break; - } - - case CXCursorKind.CXCursor_FieldDecl: - { - result = new FieldDecl(handle); - break; - } - - case CXCursorKind.CXCursor_EnumConstantDecl: - { - result = new EnumConstantDecl(handle); - break; - } - - case CXCursorKind.CXCursor_FunctionDecl: - { - result = new FunctionDecl(handle); - break; - } - - case CXCursorKind.CXCursor_VarDecl: - { - result = new VarDecl(handle); - break; - } - - case CXCursorKind.CXCursor_ParmDecl: - { - result = new ParmVarDecl(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCInterfaceDecl: - { - result = new ObjCInterfaceDecl(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCCategoryDecl: - { - result = new ObjCCategoryDecl(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCProtocolDecl: - { - result = new ObjCProtocolDecl(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCPropertyDecl: - { - result = new ObjCPropertyDecl(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCIvarDecl: - { - result = new ObjCIvarDecl(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCInstanceMethodDecl: - case CXCursorKind.CXCursor_ObjCClassMethodDecl: - { - result = new ObjCMethodDecl(handle, handle.Kind); - break; - } - - case CXCursorKind.CXCursor_ObjCImplementationDecl: - { - result = new ObjCImplementationDecl(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCCategoryImplDecl: - { - result = new ObjCCategoryImplDecl(handle); - break; - } - - case CXCursorKind.CXCursor_TypedefDecl: - { - result = new TypedefDecl(handle); - break; - } - - case CXCursorKind.CXCursor_CXXMethod: - { - result = new CXXMethodDecl(handle); - break; - } - - case CXCursorKind.CXCursor_Namespace: - { - result = new NamespaceDecl(handle); - break; - } - - case CXCursorKind.CXCursor_LinkageSpec: - { - result = new LinkageSpecDecl(handle); - break; - } - - case CXCursorKind.CXCursor_Constructor: - { - result = new CXXConstructorDecl(handle); - break; - } - - case CXCursorKind.CXCursor_Destructor: - { - result = new CXXDestructorDecl(handle); - break; - } - - case CXCursorKind.CXCursor_ConversionFunction: - { - result = new CXXConversionDecl(handle); - break; - } - - case CXCursorKind.CXCursor_TemplateTypeParameter: - { - result = new TemplateTypeParmDecl(handle); - break; - } - - case CXCursorKind.CXCursor_NonTypeTemplateParameter: - { - result = new NonTypeTemplateParmDecl(handle); - break; - } - - case CXCursorKind.CXCursor_TemplateTemplateParameter: - { - result = new TemplateTemplateParmDecl(handle); - break; - } - - case CXCursorKind.CXCursor_FunctionTemplate: - { - result = new FunctionTemplateDecl(handle); - break; - } - - case CXCursorKind.CXCursor_ClassTemplate: - { - result = new ClassTemplateDecl(handle); - break; - } - - case CXCursorKind.CXCursor_ClassTemplatePartialSpecialization: - { - result = new ClassTemplatePartialSpecializationDecl(handle); - break; - } - - case CXCursorKind.CXCursor_NamespaceAlias: - { - result = new NamespaceAliasDecl(handle); - break; - } - - case CXCursorKind.CXCursor_UsingDirective: - { - result = new UsingDirectiveDecl(handle); - break; - } - - case CXCursorKind.CXCursor_UsingDeclaration: - { - result = new UsingDecl(handle); - break; - } - - case CXCursorKind.CXCursor_TypeAliasDecl: - { - result = new TypeAliasDecl(handle); - break; - } - - case CXCursorKind.CXCursor_CXXAccessSpecifier: - { - result = new AccessSpecDecl(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCSynthesizeDecl: - case CXCursorKind.CXCursor_ObjCDynamicDecl: - { - result = new ObjCPropertyImplDecl(handle, handle.Kind); - break; - } - - case CXCursorKind.CXCursor_ModuleImportDecl: - { - result = new ImportDecl(handle); - break; - } - - case CXCursorKind.CXCursor_TypeAliasTemplateDecl: - { - result = new TypeAliasTemplateDecl(handle); - break; - } - - case CXCursorKind.CXCursor_StaticAssert: - { - result = new StaticAssertDecl(handle); - break; - } - - case CXCursorKind.CXCursor_FriendDecl: - { - result = new FriendDecl(handle); - break; - } - - default: - { - Debug.WriteLine($"Unhandled declaration kind: {handle.KindSpelling}."); - result = new Decl(handle, handle.Kind); - break; - } - } - - return result; - } + CX_DeclKind.CX_DeclKind_AccessSpec => new AccessSpecDecl(handle), + CX_DeclKind.CX_DeclKind_Block => new BlockDecl(handle), + CX_DeclKind.CX_DeclKind_Captured => new CapturedDecl(handle), + CX_DeclKind.CX_DeclKind_ClassScopeFunctionSpecialization => new ClassScopeFunctionSpecializationDecl(handle), + CX_DeclKind.CX_DeclKind_Empty => new EmptyDecl(handle), + CX_DeclKind.CX_DeclKind_Export => new ExportDecl(handle), + CX_DeclKind.CX_DeclKind_ExternCContext => new ExternCContextDecl(handle), + CX_DeclKind.CX_DeclKind_FileScopeAsm => new FileScopeAsmDecl(handle), + CX_DeclKind.CX_DeclKind_Friend => new FriendDecl(handle), + CX_DeclKind.CX_DeclKind_FriendTemplate => new FriendTemplateDecl(handle), + CX_DeclKind.CX_DeclKind_Import => new ImportDecl(handle), + CX_DeclKind.CX_DeclKind_LinkageSpec => new LinkageSpecDecl(handle), + CX_DeclKind.CX_DeclKind_Label => new LabelDecl(handle), + CX_DeclKind.CX_DeclKind_Namespace => new NamespaceDecl(handle), + CX_DeclKind.CX_DeclKind_NamespaceAlias => new NamespaceAliasDecl(handle), + CX_DeclKind.CX_DeclKind_ObjCCompatibleAlias => new ObjCCompatibleAliasDecl(handle), + CX_DeclKind.CX_DeclKind_ObjCCategory => new ObjCCategoryDecl(handle), + CX_DeclKind.CX_DeclKind_ObjCCategoryImpl => new ObjCCategoryImplDecl(handle), + CX_DeclKind.CX_DeclKind_ObjCImplementation => new ObjCImplementationDecl(handle), + CX_DeclKind.CX_DeclKind_ObjCInterface => new ObjCInterfaceDecl(handle), + CX_DeclKind.CX_DeclKind_ObjCProtocol => new ObjCPropertyDecl(handle), + CX_DeclKind.CX_DeclKind_ObjCMethod => new ObjCMethodDecl(handle), + CX_DeclKind.CX_DeclKind_ObjCProperty => new ObjCPropertyDecl(handle), + CX_DeclKind.CX_DeclKind_BuiltinTemplate => new BuiltinTemplateDecl(handle), + CX_DeclKind.CX_DeclKind_Concept => new ConceptDecl(handle), + CX_DeclKind.CX_DeclKind_ClassTemplate => new ClassTemplateDecl(handle), + CX_DeclKind.CX_DeclKind_FunctionTemplate => new FunctionTemplateDecl(handle), + CX_DeclKind.CX_DeclKind_TypeAliasTemplate => new TypeAliasTemplateDecl(handle), + CX_DeclKind.CX_DeclKind_VarTemplate => new VarTemplateDecl(handle), + CX_DeclKind.CX_DeclKind_TemplateTemplateParm => new TemplateTemplateParmDecl(handle), + CX_DeclKind.CX_DeclKind_Enum => new EnumDecl(handle), + CX_DeclKind.CX_DeclKind_Record => new RecordDecl(handle), + CX_DeclKind.CX_DeclKind_CXXRecord => new CXXRecordDecl(handle), + CX_DeclKind.CX_DeclKind_ClassTemplateSpecialization => new ClassTemplateSpecializationDecl(handle), + CX_DeclKind.CX_DeclKind_ClassTemplatePartialSpecialization => new ClassTemplatePartialSpecializationDecl(handle), + CX_DeclKind.CX_DeclKind_TemplateTypeParm => new TemplateTypeParmDecl(handle), + CX_DeclKind.CX_DeclKind_ObjCTypeParam => new ObjCTypeParamDecl(handle), + CX_DeclKind.CX_DeclKind_TypeAlias => new TypeAliasDecl(handle), + CX_DeclKind.CX_DeclKind_Typedef => new TypedefDecl(handle), + CX_DeclKind.CX_DeclKind_UnresolvedUsingTypename => new UnresolvedUsingTypenameDecl(handle), + CX_DeclKind.CX_DeclKind_Using => new UsingDecl(handle), + CX_DeclKind.CX_DeclKind_UsingDirective => new UsingDirectiveDecl(handle), + CX_DeclKind.CX_DeclKind_UsingPack => new UsingPackDecl(handle), + CX_DeclKind.CX_DeclKind_UsingShadow => new UsingShadowDecl(handle), + CX_DeclKind.CX_DeclKind_ConstructorUsingShadow => new ConstructorUsingShadowDecl(handle), + CX_DeclKind.CX_DeclKind_Binding => new BindingDecl(handle), + CX_DeclKind.CX_DeclKind_Field => new FieldDecl(handle), + CX_DeclKind.CX_DeclKind_ObjCAtDefsField => new ObjCAtDefsFieldDecl(handle), + CX_DeclKind.CX_DeclKind_ObjCIvar => new ObjCIvarDecl(handle), + CX_DeclKind.CX_DeclKind_Function => new FunctionDecl(handle), + CX_DeclKind.CX_DeclKind_CXXDeductionGuide => new CXXDeductionGuideDecl(handle), + CX_DeclKind.CX_DeclKind_CXXMethod => new CXXMethodDecl(handle), + CX_DeclKind.CX_DeclKind_CXXConstructor => new CXXConstructorDecl(handle), + CX_DeclKind.CX_DeclKind_CXXConversion => new CXXConversionDecl(handle), + CX_DeclKind.CX_DeclKind_CXXDestructor => new CXXDestructorDecl(handle), + CX_DeclKind.CX_DeclKind_MSProperty => new MSPropertyDecl(handle), + CX_DeclKind.CX_DeclKind_NonTypeTemplateParm => new NonTypeTemplateParmDecl(handle), + CX_DeclKind.CX_DeclKind_Var => new VarDecl(handle), + CX_DeclKind.CX_DeclKind_Decomposition => new DecompositionDecl(handle), + CX_DeclKind.CX_DeclKind_ImplicitParam => new ImplicitParamDecl(handle), + CX_DeclKind.CX_DeclKind_OMPCapturedExpr => new OMPCapturedExprDecl(handle), + CX_DeclKind.CX_DeclKind_ParmVar => new ParmVarDecl(handle), + CX_DeclKind.CX_DeclKind_VarTemplateSpecialization => new VarTemplateSpecializationDecl(handle), + CX_DeclKind.CX_DeclKind_VarTemplatePartialSpecialization => new VarTemplatePartialSpecializationDecl(handle), + CX_DeclKind.CX_DeclKind_EnumConstant => new EnumConstantDecl(handle), + CX_DeclKind.CX_DeclKind_IndirectField => new IndirectFieldDecl(handle), + CX_DeclKind.CX_DeclKind_OMPDeclareMapper => new OMPDeclareMapperDecl(handle), + CX_DeclKind.CX_DeclKind_OMPDeclareReduction => new OMPDeclareReductionDecl(handle), + CX_DeclKind.CX_DeclKind_UnresolvedUsingValue => new UnresolvedUsingValueDecl(handle), + CX_DeclKind.CX_DeclKind_OMPAllocate => new OMPAllocateDecl(handle), + CX_DeclKind.CX_DeclKind_OMPRequires => new OMPRequiresDecl(handle), + CX_DeclKind.CX_DeclKind_OMPThreadPrivate => new OMPThreadPrivateDecl(handle), + CX_DeclKind.CX_DeclKind_ObjCPropertyImpl => new ObjCPropertyImplDecl(handle), + CX_DeclKind.CX_DeclKind_PragmaComment => new PragmaCommentDecl(handle), + CX_DeclKind.CX_DeclKind_PragmaDetectMismatch => new PragmaDetectMismatchDecl(handle), + CX_DeclKind.CX_DeclKind_StaticAssert => new StaticAssertDecl(handle), + CX_DeclKind.CX_DeclKind_TranslationUnit => new TranslationUnitDecl(handle), + _ => new Decl(handle, handle.kind, handle.DeclKind), + }; } } diff --git a/sources/ClangSharp/Cursors/Decls/DeclaratorDecl.cs b/sources/ClangSharp/Cursors/Decls/DeclaratorDecl.cs index 35fc055f..d8c235ed 100644 --- a/sources/ClangSharp/Cursors/Decls/DeclaratorDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/DeclaratorDecl.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class DeclaratorDecl : ValueDecl { - private protected DeclaratorDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected DeclaratorDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { + if ((CX_DeclKind.CX_DeclKind_LastDeclarator < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstDeclarator)) + { + throw new ArgumentException(nameof(handle)); + } } } } diff --git a/sources/ClangSharp/Cursors/Decls/DecompositionDecl.cs b/sources/ClangSharp/Cursors/Decls/DecompositionDecl.cs new file mode 100644 index 00000000..9cdee17d --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/DecompositionDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class DecompositionDecl : VarDecl + { + internal DecompositionDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_Decomposition) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/EmptyDecl.cs b/sources/ClangSharp/Cursors/Decls/EmptyDecl.cs new file mode 100644 index 00000000..23ba1241 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/EmptyDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class EmptyDecl : Decl + { + internal EmptyDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_Empty) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/EnumConstantDecl.cs b/sources/ClangSharp/Cursors/Decls/EnumConstantDecl.cs index 0de0ed7f..6506c32b 100644 --- a/sources/ClangSharp/Cursors/Decls/EnumConstantDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/EnumConstantDecl.cs @@ -10,7 +10,7 @@ public sealed class EnumConstantDecl : ValueDecl, IMergeable { private readonly Lazy _initExpr; - internal EnumConstantDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_EnumConstantDecl) + internal EnumConstantDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_EnumConstantDecl, CX_DeclKind.CX_DeclKind_EnumConstant) { _initExpr = new Lazy(() => CursorChildren.OfType().SingleOrDefault()); } diff --git a/sources/ClangSharp/Cursors/Decls/EnumDecl.cs b/sources/ClangSharp/Cursors/Decls/EnumDecl.cs index cd28f0af..362b60e3 100644 --- a/sources/ClangSharp/Cursors/Decls/EnumDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/EnumDecl.cs @@ -12,7 +12,7 @@ public sealed class EnumDecl : TagDecl private readonly Lazy> _enumerators; private readonly Lazy _integerType; - internal EnumDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_EnumDecl) + internal EnumDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_EnumDecl, CX_DeclKind.CX_DeclKind_Enum) { _enumerators = new Lazy>(() => Decls.OfType().ToList()); _integerType = new Lazy(() => TranslationUnit.GetOrCreate(Handle.EnumDecl_IntegerType)); diff --git a/sources/ClangSharp/Cursors/Decls/ExportDecl.cs b/sources/ClangSharp/Cursors/Decls/ExportDecl.cs new file mode 100644 index 00000000..de98ac79 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/ExportDecl.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace ClangSharp +{ + public sealed class ExportDecl : Decl, IDeclContext + { + private readonly Lazy> _decls; + + internal ExportDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_Export) + { + _decls = new Lazy>(() => CursorChildren.OfType().ToList()); + } + + public IReadOnlyList Decls => _decls.Value; + + public IDeclContext LexicalParent => LexicalDeclContext; + + public IDeclContext Parent => DeclContext; + } +} diff --git a/sources/ClangSharp/Cursors/Decls/ExternCContextDecl.cs b/sources/ClangSharp/Cursors/Decls/ExternCContextDecl.cs new file mode 100644 index 00000000..2da9b6cc --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/ExternCContextDecl.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace ClangSharp +{ + public sealed class ExternCContextDecl : Decl, IDeclContext + { + private readonly Lazy> _decls; + + internal ExternCContextDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_ExternCContext) + { + _decls = new Lazy>(() => CursorChildren.OfType().ToList()); + } + + public IReadOnlyList Decls => _decls.Value; + + public IDeclContext LexicalParent => LexicalDeclContext; + + public IDeclContext Parent => DeclContext; + } +} diff --git a/sources/ClangSharp/Cursors/Decls/FieldDecl.cs b/sources/ClangSharp/Cursors/Decls/FieldDecl.cs index 914c756e..239859f3 100644 --- a/sources/ClangSharp/Cursors/Decls/FieldDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/FieldDecl.cs @@ -1,17 +1,22 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class FieldDecl : DeclaratorDecl, IMergeable { - internal FieldDecl(CXCursor handle) : this(handle, CXCursorKind.CXCursor_FieldDecl) + internal FieldDecl(CXCursor handle) : this(handle, CXCursorKind.CXCursor_FieldDecl, CX_DeclKind.CX_DeclKind_Field) { } - private protected FieldDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected FieldDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { + if ((CX_DeclKind.CX_DeclKind_LastField < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstField)) + { + throw new ArgumentException(nameof(handle)); + } } public int BitWidthValue => Handle.FieldDeclBitWidth; diff --git a/sources/ClangSharp/Cursors/Decls/FileScopeAsmDecl.cs b/sources/ClangSharp/Cursors/Decls/FileScopeAsmDecl.cs new file mode 100644 index 00000000..d89d557a --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/FileScopeAsmDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class FileScopeAsmDecl : Decl + { + internal FileScopeAsmDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_FileScopeAsm) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/FriendDecl.cs b/sources/ClangSharp/Cursors/Decls/FriendDecl.cs index 9cbfeccb..d4e21533 100644 --- a/sources/ClangSharp/Cursors/Decls/FriendDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/FriendDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class FriendDecl : Decl { - internal FriendDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_FriendDecl) + internal FriendDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_FriendDecl, CX_DeclKind.CX_DeclKind_Friend) { } } diff --git a/sources/ClangSharp/Cursors/Decls/FriendTemplateDecl.cs b/sources/ClangSharp/Cursors/Decls/FriendTemplateDecl.cs new file mode 100644 index 00000000..dd94f154 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/FriendTemplateDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class FriendTemplateDecl : Decl + { + internal FriendTemplateDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_FriendTemplate) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/FunctionDecl.cs b/sources/ClangSharp/Cursors/Decls/FunctionDecl.cs index baed035e..acb7eebc 100644 --- a/sources/ClangSharp/Cursors/Decls/FunctionDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/FunctionDecl.cs @@ -14,12 +14,17 @@ public class FunctionDecl : DeclaratorDecl, IDeclContext, IRedeclarable> _parameters; private readonly Lazy _returnType; - internal FunctionDecl(CXCursor handle) : this(handle, CXCursorKind.CXCursor_FunctionDecl) + internal FunctionDecl(CXCursor handle) : this(handle, CXCursorKind.CXCursor_FunctionDecl, CX_DeclKind.CX_DeclKind_Function) { } - private protected FunctionDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected FunctionDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { + if ((CX_DeclKind.CX_DeclKind_LastFunction < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstFunction)) + { + throw new ArgumentException(nameof(handle)); + } + _body = new Lazy(() => CursorChildren.OfType().SingleOrDefault()); _decls = new Lazy>(() => CursorChildren.OfType().ToList()); _parameters = new Lazy>(() => Decls.OfType().ToList()); diff --git a/sources/ClangSharp/Cursors/Decls/FunctionTemplateDecl.cs b/sources/ClangSharp/Cursors/Decls/FunctionTemplateDecl.cs index 5d48a615..184d32f2 100644 --- a/sources/ClangSharp/Cursors/Decls/FunctionTemplateDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/FunctionTemplateDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class FunctionTemplateDecl : RedeclarableTemplateDecl { - internal FunctionTemplateDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_FunctionTemplate) + internal FunctionTemplateDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_FunctionTemplate, CX_DeclKind.CX_DeclKind_FunctionTemplate) { } } diff --git a/sources/ClangSharp/Cursors/Decls/ImplicitParamDecl.cs b/sources/ClangSharp/Cursors/Decls/ImplicitParamDecl.cs new file mode 100644 index 00000000..28e9414a --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/ImplicitParamDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ImplicitParamDecl : VarDecl + { + internal ImplicitParamDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_ImplicitParam) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/ImportDecl.cs b/sources/ClangSharp/Cursors/Decls/ImportDecl.cs index c80bc658..442514e1 100644 --- a/sources/ClangSharp/Cursors/Decls/ImportDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ImportDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ImportDecl : Decl { - internal ImportDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ModuleImportDecl) + internal ImportDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ModuleImportDecl, CX_DeclKind.CX_DeclKind_Import) { } } diff --git a/sources/ClangSharp/Cursors/Decls/IndirectFieldDecl.cs b/sources/ClangSharp/Cursors/Decls/IndirectFieldDecl.cs new file mode 100644 index 00000000..0779f4b6 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/IndirectFieldDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class IndirectFieldDecl : ValueDecl, IMergeable + { + internal IndirectFieldDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_IndirectField) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/LabelDecl.cs b/sources/ClangSharp/Cursors/Decls/LabelDecl.cs new file mode 100644 index 00000000..e9c5bede --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/LabelDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class LabelDecl : NamedDecl + { + internal LabelDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_Label) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/LinkageSpecDecl.cs b/sources/ClangSharp/Cursors/Decls/LinkageSpecDecl.cs index 99c42899..be162098 100644 --- a/sources/ClangSharp/Cursors/Decls/LinkageSpecDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/LinkageSpecDecl.cs @@ -11,9 +11,14 @@ public sealed class LinkageSpecDecl : Decl, IDeclContext { private readonly Lazy> _decls; - internal LinkageSpecDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_LinkageSpec) + internal LinkageSpecDecl(CXCursor handle) : base(handle, handle.Kind, CX_DeclKind.CX_DeclKind_LinkageSpec) { - _decls = new Lazy>(() => CursorChildren.Where((cursor) => cursor is Decl).Cast().ToList()); + if ((handle.Kind != CXCursorKind.CXCursor_LinkageSpec) && (handle.Kind != CXCursorKind.CXCursor_UnexposedDecl)) + { + throw new ArgumentException(nameof(handle)); + } + + _decls = new Lazy>(() => CursorChildren.OfType().ToList()); } public IReadOnlyList Decls => _decls.Value; diff --git a/sources/ClangSharp/Cursors/Decls/MSPropertyDecl.cs b/sources/ClangSharp/Cursors/Decls/MSPropertyDecl.cs new file mode 100644 index 00000000..7039b8c6 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/MSPropertyDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class MSPropertyDecl : DeclaratorDecl + { + internal MSPropertyDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_MSProperty) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/NamedDecl.cs b/sources/ClangSharp/Cursors/Decls/NamedDecl.cs index ef1d7015..530b94f9 100644 --- a/sources/ClangSharp/Cursors/Decls/NamedDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/NamedDecl.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class NamedDecl : Decl { - private protected NamedDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected NamedDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { + if ((CX_DeclKind.CX_DeclKind_LastNamed < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstNamed)) + { + throw new ArgumentException(nameof(handle)); + } } public CXLinkageKind LinkageInternal => Handle.Linkage; diff --git a/sources/ClangSharp/Cursors/Decls/NamespaceAliasDecl.cs b/sources/ClangSharp/Cursors/Decls/NamespaceAliasDecl.cs index c52c2f23..564d26ac 100644 --- a/sources/ClangSharp/Cursors/Decls/NamespaceAliasDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/NamespaceAliasDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class NamespaceAliasDecl : NamedDecl, IRedeclarable { - internal NamespaceAliasDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_NamespaceAlias) + internal NamespaceAliasDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_NamespaceAlias, CX_DeclKind.CX_DeclKind_NamespaceAlias) { } } diff --git a/sources/ClangSharp/Cursors/Decls/NamespaceDecl.cs b/sources/ClangSharp/Cursors/Decls/NamespaceDecl.cs index 628846e7..979d1a21 100644 --- a/sources/ClangSharp/Cursors/Decls/NamespaceDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/NamespaceDecl.cs @@ -11,7 +11,7 @@ public sealed class NamespaceDecl : NamedDecl, IDeclContext, IRedeclarable> _decls; - internal NamespaceDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Namespace) + internal NamespaceDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Namespace, CX_DeclKind.CX_DeclKind_Namespace) { _decls = new Lazy>(() => CursorChildren.OfType().ToList()); } diff --git a/sources/ClangSharp/Cursors/Decls/NonTypeTemplateParmDecl.cs b/sources/ClangSharp/Cursors/Decls/NonTypeTemplateParmDecl.cs index ffc3fc32..1e1e93f3 100644 --- a/sources/ClangSharp/Cursors/Decls/NonTypeTemplateParmDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/NonTypeTemplateParmDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class NonTypeTemplateParmDecl : DeclaratorDecl, ITemplateParmPosition { - internal NonTypeTemplateParmDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_NonTypeTemplateParameter) + internal NonTypeTemplateParmDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_NonTypeTemplateParameter, CX_DeclKind.CX_DeclKind_NonTypeTemplateParm) { } } diff --git a/sources/ClangSharp/Cursors/Decls/OMPAllocateDecl.cs b/sources/ClangSharp/Cursors/Decls/OMPAllocateDecl.cs new file mode 100644 index 00000000..da48b56c --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/OMPAllocateDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class OMPAllocateDecl : Decl + { + internal OMPAllocateDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_OMPAllocate) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/OMPCapturedExprDecl.cs b/sources/ClangSharp/Cursors/Decls/OMPCapturedExprDecl.cs new file mode 100644 index 00000000..9c80e981 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/OMPCapturedExprDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class OMPCapturedExprDecl : VarDecl + { + internal OMPCapturedExprDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_OMPCapturedExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/OMPDeclareMapperDecl.cs b/sources/ClangSharp/Cursors/Decls/OMPDeclareMapperDecl.cs new file mode 100644 index 00000000..117179f5 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/OMPDeclareMapperDecl.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace ClangSharp +{ + public sealed class OMPDeclareMapperDecl : ValueDecl, IDeclContext + { + private readonly Lazy> _decls; + + internal OMPDeclareMapperDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_OMPDeclareMapper) + { + _decls = new Lazy>(() => CursorChildren.OfType().ToList()); + } + + public IReadOnlyList Decls => _decls.Value; + + public IDeclContext LexicalParent => LexicalDeclContext; + + public IDeclContext Parent => DeclContext; + } +} diff --git a/sources/ClangSharp/Cursors/Decls/OMPDeclareReductionDecl.cs b/sources/ClangSharp/Cursors/Decls/OMPDeclareReductionDecl.cs new file mode 100644 index 00000000..9e206fb9 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/OMPDeclareReductionDecl.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace ClangSharp +{ + public sealed class OMPDeclareReductionDecl : ValueDecl, IDeclContext + { + private readonly Lazy> _decls; + + internal OMPDeclareReductionDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_OMPDeclareReduction) + { + _decls = new Lazy>(() => CursorChildren.OfType().ToList()); + } + + public IReadOnlyList Decls => _decls.Value; + + public IDeclContext LexicalParent => LexicalDeclContext; + + public IDeclContext Parent => DeclContext; + } +} diff --git a/sources/ClangSharp/Cursors/Decls/OMPRequiresDecl.cs b/sources/ClangSharp/Cursors/Decls/OMPRequiresDecl.cs new file mode 100644 index 00000000..3e675b90 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/OMPRequiresDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class OMPRequiresDecl : Decl + { + internal OMPRequiresDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_OMPRequires) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/OMPThreadPrivateDecl.cs b/sources/ClangSharp/Cursors/Decls/OMPThreadPrivateDecl.cs new file mode 100644 index 00000000..f0c3f8f7 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/OMPThreadPrivateDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class OMPThreadPrivateDecl : Decl + { + internal OMPThreadPrivateDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_OMPThreadPrivate) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/ObjCAtDefsFieldDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCAtDefsFieldDecl.cs new file mode 100644 index 00000000..8e4584dd --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/ObjCAtDefsFieldDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ObjCAtDefsFieldDecl : FieldDecl + { + internal ObjCAtDefsFieldDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_ObjCAtDefsField) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/ObjCCategoryDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCCategoryDecl.cs index d8930878..a08c8338 100644 --- a/sources/ClangSharp/Cursors/Decls/ObjCCategoryDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ObjCCategoryDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCCategoryDecl : ObjCContainerDecl { - internal ObjCCategoryDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCCategoryDecl) + internal ObjCCategoryDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCCategoryDecl, CX_DeclKind.CX_DeclKind_ObjCCategory) { } } diff --git a/sources/ClangSharp/Cursors/Decls/ObjCCategoryImplDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCCategoryImplDecl.cs index 59b850ec..943b6a71 100644 --- a/sources/ClangSharp/Cursors/Decls/ObjCCategoryImplDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ObjCCategoryImplDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCCategoryImplDecl : ObjCImplDecl { - internal ObjCCategoryImplDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCCategoryImplDecl) + internal ObjCCategoryImplDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCCategoryImplDecl, CX_DeclKind.CX_DeclKind_ObjCCategoryImpl) { } } diff --git a/sources/ClangSharp/Cursors/Decls/ObjCCompatibleAliasDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCCompatibleAliasDecl.cs new file mode 100644 index 00000000..0ffc18eb --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/ObjCCompatibleAliasDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ObjCCompatibleAliasDecl : NamedDecl + { + internal ObjCCompatibleAliasDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_ObjCCompatibleAlias) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/ObjCContainerDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCContainerDecl.cs index a614f482..9bd63f7e 100644 --- a/sources/ClangSharp/Cursors/Decls/ObjCContainerDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ObjCContainerDecl.cs @@ -11,9 +11,14 @@ public class ObjCContainerDecl : NamedDecl, IDeclContext { private readonly Lazy> _decls; - private protected ObjCContainerDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected ObjCContainerDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { - _decls = new Lazy>(() => CursorChildren.Where((cursor) => cursor is Decl).Cast().ToList()); + if ((CX_DeclKind.CX_DeclKind_LastObjCContainer < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstObjCContainer)) + { + throw new ArgumentException(nameof(handle)); + } + + _decls = new Lazy>(() => CursorChildren.OfType().ToList()); } public IReadOnlyList Decls => _decls.Value; diff --git a/sources/ClangSharp/Cursors/Decls/ObjCImplDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCImplDecl.cs index 5857898d..f3bc9eb4 100644 --- a/sources/ClangSharp/Cursors/Decls/ObjCImplDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ObjCImplDecl.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class ObjCImplDecl : ObjCContainerDecl { - private protected ObjCImplDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected ObjCImplDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { + if ((CX_DeclKind.CX_DeclKind_LastObjCImpl < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstObjCImpl)) + { + throw new ArgumentException(nameof(handle)); + } } } } diff --git a/sources/ClangSharp/Cursors/Decls/ObjCImplementationDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCImplementationDecl.cs index 5e6d4cb2..9a94a099 100644 --- a/sources/ClangSharp/Cursors/Decls/ObjCImplementationDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ObjCImplementationDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCImplementationDecl : ObjCImplDecl { - internal ObjCImplementationDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCImplementationDecl) + internal ObjCImplementationDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCImplementationDecl, CX_DeclKind.CX_DeclKind_ObjCImplementation) { } } diff --git a/sources/ClangSharp/Cursors/Decls/ObjCInterfaceDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCInterfaceDecl.cs index 4570a5dd..a8c54732 100644 --- a/sources/ClangSharp/Cursors/Decls/ObjCInterfaceDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ObjCInterfaceDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCInterfaceDecl : ObjCContainerDecl, IRedeclarable { - internal ObjCInterfaceDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCInterfaceDecl) + internal ObjCInterfaceDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCInterfaceDecl, CX_DeclKind.CX_DeclKind_ObjCInterface) { } } diff --git a/sources/ClangSharp/Cursors/Decls/ObjCIvarDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCIvarDecl.cs index 65ba99f5..4573bb0c 100644 --- a/sources/ClangSharp/Cursors/Decls/ObjCIvarDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ObjCIvarDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCIvarDecl : FieldDecl { - internal ObjCIvarDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCIvarDecl) + internal ObjCIvarDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCIvarDecl, CX_DeclKind.CX_DeclKind_ObjCIvar) { } } diff --git a/sources/ClangSharp/Cursors/Decls/ObjCMethodDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCMethodDecl.cs index 5bd9ae4b..b6f44d5b 100644 --- a/sources/ClangSharp/Cursors/Decls/ObjCMethodDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ObjCMethodDecl.cs @@ -11,9 +11,14 @@ public sealed class ObjCMethodDecl : NamedDecl, IDeclContext { private readonly Lazy> _decls; - internal ObjCMethodDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + internal ObjCMethodDecl(CXCursor handle) : base(handle, handle.Kind, CX_DeclKind.CX_DeclKind_ObjCMethod) { - _decls = new Lazy>(() => CursorChildren.Where((cursor) => cursor is Decl).Cast().ToList()); + if ((handle.Kind != CXCursorKind.CXCursor_ObjCInstanceMethodDecl) && (handle.Kind != CXCursorKind.CXCursor_ObjCClassMethodDecl)) + { + throw new ArgumentException(nameof(handle)); + } + + _decls = new Lazy>(() => CursorChildren.OfType().ToList()); } public IReadOnlyList Decls => _decls.Value; diff --git a/sources/ClangSharp/Cursors/Decls/ObjCPropertyDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCPropertyDecl.cs index 74887544..b8afcd29 100644 --- a/sources/ClangSharp/Cursors/Decls/ObjCPropertyDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ObjCPropertyDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCPropertyDecl : NamedDecl { - internal ObjCPropertyDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCPropertyDecl) + internal ObjCPropertyDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCPropertyDecl, CX_DeclKind.CX_DeclKind_ObjCProperty) { } } diff --git a/sources/ClangSharp/Cursors/Decls/ObjCPropertyImplDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCPropertyImplDecl.cs index b6e3136a..990362d5 100644 --- a/sources/ClangSharp/Cursors/Decls/ObjCPropertyImplDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ObjCPropertyImplDecl.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public sealed class ObjCPropertyImplDecl : Decl { - internal ObjCPropertyImplDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + internal ObjCPropertyImplDecl(CXCursor handle) : base(handle, handle.Kind, CX_DeclKind.CX_DeclKind_ObjCPropertyImpl) { + if ((handle.Kind != CXCursorKind.CXCursor_ObjCSynthesizeDecl) && (handle.Kind != CXCursorKind.CXCursor_ObjCDynamicDecl)) + { + throw new ArgumentException(nameof(handle)); + } } } } diff --git a/sources/ClangSharp/Cursors/Decls/ObjCProtocolDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCProtocolDecl.cs index 8961ef2e..d95cd468 100644 --- a/sources/ClangSharp/Cursors/Decls/ObjCProtocolDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ObjCProtocolDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCProtocolDecl : ObjCContainerDecl, IRedeclarable { - internal ObjCProtocolDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCProtocolDecl) + internal ObjCProtocolDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCProtocolDecl, CX_DeclKind.CX_DeclKind_ObjCProtocol) { } } diff --git a/sources/ClangSharp/Cursors/Decls/ObjCTypeParamDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCTypeParamDecl.cs new file mode 100644 index 00000000..6d66f972 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/ObjCTypeParamDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ObjCTypeParamDecl : TypedefNameDecl + { + internal ObjCTypeParamDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_ObjCTypeParam) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/ParmVarDecl.cs b/sources/ClangSharp/Cursors/Decls/ParmVarDecl.cs index 9bc9e28f..ff180188 100644 --- a/sources/ClangSharp/Cursors/Decls/ParmVarDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ParmVarDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ParmVarDecl : VarDecl { - internal ParmVarDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ParmDecl) + internal ParmVarDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ParmDecl, CX_DeclKind.CX_DeclKind_ParmVar) { } } diff --git a/sources/ClangSharp/Cursors/Decls/PragmaCommentDecl.cs b/sources/ClangSharp/Cursors/Decls/PragmaCommentDecl.cs new file mode 100644 index 00000000..464b7fd4 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/PragmaCommentDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class PragmaCommentDecl : Decl + { + internal PragmaCommentDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_PragmaComment) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/PragmaDetectMismatchDecl.cs b/sources/ClangSharp/Cursors/Decls/PragmaDetectMismatchDecl.cs new file mode 100644 index 00000000..64912fd9 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/PragmaDetectMismatchDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class PragmaDetectMismatchDecl : Decl + { + internal PragmaDetectMismatchDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_PragmaDetectMismatch) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/RecordDecl.cs b/sources/ClangSharp/Cursors/Decls/RecordDecl.cs index e9bafe96..6ea871e5 100644 --- a/sources/ClangSharp/Cursors/Decls/RecordDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/RecordDecl.cs @@ -11,8 +11,22 @@ public class RecordDecl : TagDecl { private readonly Lazy> _fields; - internal RecordDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + internal RecordDecl(CXCursor handle) : this(handle, handle.Kind, CX_DeclKind.CX_DeclKind_Record) { + } + + private protected RecordDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) + { + if ((CX_DeclKind.CX_DeclKind_LastRecord < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstRecord)) + { + throw new ArgumentException(nameof(handle)); + } + + if ((handle.Kind != CXCursorKind.CXCursor_StructDecl) && (handle.Kind != CXCursorKind.CXCursor_UnionDecl) && (handle.Kind != CXCursorKind.CXCursor_ClassDecl) && (handle.Kind != CXCursorKind.CXCursor_ClassTemplatePartialSpecialization)) + { + throw new ArgumentException(nameof(handle)); + } + _fields = new Lazy>(() => Decls.OfType().ToList()); } diff --git a/sources/ClangSharp/Cursors/Decls/RedeclarableTemplateDecl.cs b/sources/ClangSharp/Cursors/Decls/RedeclarableTemplateDecl.cs index ad880692..cababb06 100644 --- a/sources/ClangSharp/Cursors/Decls/RedeclarableTemplateDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/RedeclarableTemplateDecl.cs @@ -9,8 +9,13 @@ public class RedeclarableTemplateDecl : TemplateDecl, IRedeclarable _instantiatedFromMemberTemplate; - private protected RedeclarableTemplateDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected RedeclarableTemplateDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { + if ((CX_DeclKind.CX_DeclKind_LastRedeclarableTemplate < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstRedeclarableTemplate)) + { + throw new ArgumentException(nameof(handle)); + } + _instantiatedFromMemberTemplate = new Lazy(() => TranslationUnit.GetOrCreate(Handle.SpecializedCursorTemplate)); } diff --git a/sources/ClangSharp/Cursors/Decls/StaticAssertDecl.cs b/sources/ClangSharp/Cursors/Decls/StaticAssertDecl.cs index cecd16cc..23202b0e 100644 --- a/sources/ClangSharp/Cursors/Decls/StaticAssertDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/StaticAssertDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class StaticAssertDecl : Decl { - internal StaticAssertDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_StaticAssert) + internal StaticAssertDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_StaticAssert, CX_DeclKind.CX_DeclKind_StaticAssert) { } } diff --git a/sources/ClangSharp/Cursors/Decls/TagDecl.cs b/sources/ClangSharp/Cursors/Decls/TagDecl.cs index 728ab8e8..417d79ab 100644 --- a/sources/ClangSharp/Cursors/Decls/TagDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/TagDecl.cs @@ -12,8 +12,13 @@ public unsafe class TagDecl : TypeDecl, IDeclContext, IRedeclarable private readonly Lazy> _decls; private readonly Lazy _definition; - private protected TagDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected TagDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { + if ((CX_DeclKind.CX_DeclKind_LastTag < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstTag)) + { + throw new ArgumentException(nameof(handle)); + } + _decls = new Lazy>(() => CursorChildren.OfType().ToList()); _definition = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Definition)); } diff --git a/sources/ClangSharp/Cursors/Decls/TemplateDecl.cs b/sources/ClangSharp/Cursors/Decls/TemplateDecl.cs index 9f17e53e..83dcb841 100644 --- a/sources/ClangSharp/Cursors/Decls/TemplateDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/TemplateDecl.cs @@ -11,8 +11,13 @@ public class TemplateDecl : NamedDecl { private readonly Lazy> _templateParameters; - private protected TemplateDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected TemplateDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { + if ((CX_DeclKind.CX_DeclKind_LastTemplate < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstTemplate)) + { + throw new ArgumentException(nameof(handle)); + } + _templateParameters = new Lazy>(() => CursorChildren.Where((cursor) => (cursor is TemplateTypeParmDecl) || (cursor is NonTypeTemplateParmDecl) || (cursor is TemplateTemplateParmDecl)).Cast().ToList()); } diff --git a/sources/ClangSharp/Cursors/Decls/TemplateTemplateParmDecl.cs b/sources/ClangSharp/Cursors/Decls/TemplateTemplateParmDecl.cs index 7fd86492..35836376 100644 --- a/sources/ClangSharp/Cursors/Decls/TemplateTemplateParmDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/TemplateTemplateParmDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class TemplateTemplateParmDecl : TemplateDecl, ITemplateParmPosition { - internal TemplateTemplateParmDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_TemplateTemplateParameter) + internal TemplateTemplateParmDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_TemplateTemplateParameter, CX_DeclKind.CX_DeclKind_TemplateTemplateParm) { } } diff --git a/sources/ClangSharp/Cursors/Decls/TemplateTypeParmDecl.cs b/sources/ClangSharp/Cursors/Decls/TemplateTypeParmDecl.cs index 4ba1977d..1c92378a 100644 --- a/sources/ClangSharp/Cursors/Decls/TemplateTypeParmDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/TemplateTypeParmDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class TemplateTypeParmDecl : TypeDecl { - internal TemplateTypeParmDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_TemplateTypeParameter) + internal TemplateTypeParmDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_TemplateTypeParameter, CX_DeclKind.CX_DeclKind_TemplateTypeParm) { } } diff --git a/sources/ClangSharp/Cursors/Decls/TranslationUnitDecl.cs b/sources/ClangSharp/Cursors/Decls/TranslationUnitDecl.cs index a06ee29d..184c1a63 100644 --- a/sources/ClangSharp/Cursors/Decls/TranslationUnitDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/TranslationUnitDecl.cs @@ -11,7 +11,7 @@ public sealed unsafe class TranslationUnitDecl : Decl, IDeclContext { private readonly Lazy> _decls; - internal TranslationUnitDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_TranslationUnit) + internal TranslationUnitDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_TranslationUnit, CX_DeclKind.CX_DeclKind_TranslationUnit) { _decls = new Lazy>(() => CursorChildren.OfType().ToList()); } diff --git a/sources/ClangSharp/Cursors/Decls/TypeAliasDecl.cs b/sources/ClangSharp/Cursors/Decls/TypeAliasDecl.cs index e5adf9d3..14242117 100644 --- a/sources/ClangSharp/Cursors/Decls/TypeAliasDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/TypeAliasDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class TypeAliasDecl : TypedefNameDecl { - internal TypeAliasDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_TypeAliasDecl) + internal TypeAliasDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_TypeAliasDecl, CX_DeclKind.CX_DeclKind_TypeAlias) { } } diff --git a/sources/ClangSharp/Cursors/Decls/TypeAliasTemplateDecl.cs b/sources/ClangSharp/Cursors/Decls/TypeAliasTemplateDecl.cs index 6e817a65..445bec38 100644 --- a/sources/ClangSharp/Cursors/Decls/TypeAliasTemplateDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/TypeAliasTemplateDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class TypeAliasTemplateDecl : RedeclarableTemplateDecl { - internal TypeAliasTemplateDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_TypeAliasTemplateDecl) + internal TypeAliasTemplateDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_TypeAliasTemplateDecl, CX_DeclKind.CX_DeclKind_TypeAliasTemplate) { } } diff --git a/sources/ClangSharp/Cursors/Decls/TypeDecl.cs b/sources/ClangSharp/Cursors/Decls/TypeDecl.cs index 3ae2be85..291e3f2a 100644 --- a/sources/ClangSharp/Cursors/Decls/TypeDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/TypeDecl.cs @@ -9,8 +9,13 @@ public class TypeDecl : NamedDecl { private readonly Lazy _typeForDecl; - private protected TypeDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected TypeDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { + if ((CX_DeclKind.CX_DeclKind_LastType < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstType)) + { + throw new ArgumentException(nameof(handle)); + } + _typeForDecl = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Type)); } diff --git a/sources/ClangSharp/Cursors/Decls/TypedefDecl.cs b/sources/ClangSharp/Cursors/Decls/TypedefDecl.cs index c4d1098a..b23d6c4a 100644 --- a/sources/ClangSharp/Cursors/Decls/TypedefDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/TypedefDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class TypedefDecl : TypedefNameDecl { - internal TypedefDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_TypedefDecl) + internal TypedefDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_TypedefDecl, CX_DeclKind.CX_DeclKind_Typedef) { } } diff --git a/sources/ClangSharp/Cursors/Decls/TypedefNameDecl.cs b/sources/ClangSharp/Cursors/Decls/TypedefNameDecl.cs index 38f2ecfe..19c2f93d 100644 --- a/sources/ClangSharp/Cursors/Decls/TypedefNameDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/TypedefNameDecl.cs @@ -9,8 +9,13 @@ public class TypedefNameDecl : TypeDecl, IRedeclarable { private readonly Lazy _underlyingType; - private protected TypedefNameDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected TypedefNameDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { + if ((CX_DeclKind.CX_DeclKind_LastTypedefName < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstTypedefName)) + { + throw new ArgumentException(nameof(handle)); + } + _underlyingType = new Lazy(() => TranslationUnit.GetOrCreate(Handle.TypedefDeclUnderlyingType)); } diff --git a/sources/ClangSharp/Cursors/Decls/UnresolvedUsingTypenameDecl.cs b/sources/ClangSharp/Cursors/Decls/UnresolvedUsingTypenameDecl.cs new file mode 100644 index 00000000..976bf449 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/UnresolvedUsingTypenameDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class UnresolvedUsingTypenameDecl : TypeDecl, IMergeable + { + internal UnresolvedUsingTypenameDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UsingDeclaration, CX_DeclKind.CX_DeclKind_UnresolvedUsingTypename) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/UnresolvedUsingValueDecl.cs b/sources/ClangSharp/Cursors/Decls/UnresolvedUsingValueDecl.cs new file mode 100644 index 00000000..e9a9bc7b --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/UnresolvedUsingValueDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class UnresolvedUsingValueDecl : ValueDecl, IMergeable + { + internal UnresolvedUsingValueDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UsingDeclaration, CX_DeclKind.CX_DeclKind_UnresolvedUsingValue) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/UsingDecl.cs b/sources/ClangSharp/Cursors/Decls/UsingDecl.cs index bdf890cd..06254e85 100644 --- a/sources/ClangSharp/Cursors/Decls/UsingDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/UsingDecl.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class UsingDecl : NamedDecl, IMergeable { - internal UsingDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UsingDeclaration) + internal UsingDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UsingDeclaration, CX_DeclKind.CX_DeclKind_Using) { } } diff --git a/sources/ClangSharp/Cursors/Decls/UsingDirectiveDecl.cs b/sources/ClangSharp/Cursors/Decls/UsingDirectiveDecl.cs index 9cda195a..c34e6118 100644 --- a/sources/ClangSharp/Cursors/Decls/UsingDirectiveDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/UsingDirectiveDecl.cs @@ -4,9 +4,9 @@ namespace ClangSharp { - public class UsingDirectiveDecl : NamedDecl + public sealed class UsingDirectiveDecl : NamedDecl { - internal UsingDirectiveDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UsingDirective) + internal UsingDirectiveDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UsingDirective, CX_DeclKind.CX_DeclKind_UsingDirective) { } } diff --git a/sources/ClangSharp/Cursors/Decls/UsingPackDecl.cs b/sources/ClangSharp/Cursors/Decls/UsingPackDecl.cs new file mode 100644 index 00000000..5feb8917 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/UsingPackDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class UsingPackDecl : NamedDecl, IMergeable + { + internal UsingPackDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_UsingPack) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/UsingShadowDecl.cs b/sources/ClangSharp/Cursors/Decls/UsingShadowDecl.cs new file mode 100644 index 00000000..2f9f5f6d --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/UsingShadowDecl.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using System; +using ClangSharp.Interop; + +namespace ClangSharp +{ + public class UsingShadowDecl : NamedDecl, IRedeclarable + { + internal UsingShadowDecl(CXCursor handle) : this(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_UsingShadow) + { + } + + private protected UsingShadowDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) + { + if ((CX_DeclKind.CX_DeclKind_LastUsingShadow < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstUsingShadow)) + { + throw new ArgumentException(nameof(handle)); + } + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/ValueDecl.cs b/sources/ClangSharp/Cursors/Decls/ValueDecl.cs index 698b4079..f41addd5 100644 --- a/sources/ClangSharp/Cursors/Decls/ValueDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ValueDecl.cs @@ -9,8 +9,13 @@ public class ValueDecl : NamedDecl { private readonly Lazy _type; - private protected ValueDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected ValueDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { + if ((CX_DeclKind.CX_DeclKind_LastValue < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstValue)) + { + throw new ArgumentException(nameof(handle)); + } + _type = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Type)); } diff --git a/sources/ClangSharp/Cursors/Decls/VarDecl.cs b/sources/ClangSharp/Cursors/Decls/VarDecl.cs index 5851ef73..d67c360f 100644 --- a/sources/ClangSharp/Cursors/Decls/VarDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/VarDecl.cs @@ -9,12 +9,17 @@ public class VarDecl : DeclaratorDecl, IRedeclarable { private readonly Lazy _instantiatedFromStaticDataMember; - internal VarDecl(CXCursor handle) : this(handle, CXCursorKind.CXCursor_VarDecl) + internal VarDecl(CXCursor handle) : this(handle, CXCursorKind.CXCursor_VarDecl, CX_DeclKind.CX_DeclKind_Var) { } - private protected VarDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected VarDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { + if ((CX_DeclKind.CX_DeclKind_LastVar < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstVar)) + { + throw new ArgumentException(nameof(handle)); + } + _instantiatedFromStaticDataMember = new Lazy(() => TranslationUnit.GetOrCreate(Handle.SpecializedCursorTemplate)); } diff --git a/sources/ClangSharp/Cursors/Decls/VarTemplateDecl.cs b/sources/ClangSharp/Cursors/Decls/VarTemplateDecl.cs new file mode 100644 index 00000000..67448c81 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/VarTemplateDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class VarTemplateDecl : RedeclarableTemplateDecl + { + internal VarTemplateDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_VarTemplate) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/VarTemplatePartialSpecializationDecl.cs b/sources/ClangSharp/Cursors/Decls/VarTemplatePartialSpecializationDecl.cs new file mode 100644 index 00000000..ec7b6b3b --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/VarTemplatePartialSpecializationDecl.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public class VarTemplatePartialSpecializationDecl : VarDecl + { + internal VarTemplatePartialSpecializationDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_VarTemplatePartialSpecialization) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Decls/VarTemplateSpecializationDecl.cs b/sources/ClangSharp/Cursors/Decls/VarTemplateSpecializationDecl.cs new file mode 100644 index 00000000..098adb0e --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/VarTemplateSpecializationDecl.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using System; +using ClangSharp.Interop; + +namespace ClangSharp +{ + public class VarTemplateSpecializationDecl : VarDecl + { + internal VarTemplateSpecializationDecl(CXCursor handle) : this(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_VarTemplateSpecialization) + { + } + + private protected VarTemplateSpecializationDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) + { + if ((CX_DeclKind.CX_DeclKind_LastVarTemplateSpecialization < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstVarTemplateSpecialization)) + { + throw new ArgumentException(nameof(handle)); + } + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/AbstractConditionalOperator.cs b/sources/ClangSharp/Cursors/Exprs/AbstractConditionalOperator.cs index 1445d66e..1956b531 100644 --- a/sources/ClangSharp/Cursors/Exprs/AbstractConditionalOperator.cs +++ b/sources/ClangSharp/Cursors/Exprs/AbstractConditionalOperator.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class AbstractConditionalOperator : Expr { - private protected AbstractConditionalOperator(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected AbstractConditionalOperator(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) { + if ((CX_StmtClass.CX_StmtClass_LastAbstractConditionalOperator < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstAbstractConditionalOperator)) + { + throw new ArgumentException(nameof(handle)); + } } } } diff --git a/sources/ClangSharp/Cursors/Exprs/AddrLabelExpr.cs b/sources/ClangSharp/Cursors/Exprs/AddrLabelExpr.cs index 8182312b..4d306509 100644 --- a/sources/ClangSharp/Cursors/Exprs/AddrLabelExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/AddrLabelExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class AddrLabelExpr : Expr { - internal AddrLabelExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_AddrLabelExpr) + internal AddrLabelExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_AddrLabelExpr, CX_StmtClass.CX_StmtClass_AddrLabelExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ArrayInitIndexExpr.cs b/sources/ClangSharp/Cursors/Exprs/ArrayInitIndexExpr.cs new file mode 100644 index 00000000..efdb6822 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ArrayInitIndexExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ArrayInitIndexExpr : Expr + { + internal ArrayInitIndexExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ArrayInitIndexExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ArrayInitLoopExpr.cs b/sources/ClangSharp/Cursors/Exprs/ArrayInitLoopExpr.cs new file mode 100644 index 00000000..a6a75c5a --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ArrayInitLoopExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ArrayInitLoopExpr : Expr + { + internal ArrayInitLoopExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ArrayInitLoopExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ArraySubscriptExpr.cs b/sources/ClangSharp/Cursors/Exprs/ArraySubscriptExpr.cs index e64efb7d..400c2824 100644 --- a/sources/ClangSharp/Cursors/Exprs/ArraySubscriptExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/ArraySubscriptExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ArraySubscriptExpr : Expr { - internal ArraySubscriptExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ArraySubscriptExpr) + internal ArraySubscriptExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ArraySubscriptExpr, CX_StmtClass.CX_StmtClass_ArraySubscriptExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ArrayTypeTraitExpr.cs b/sources/ClangSharp/Cursors/Exprs/ArrayTypeTraitExpr.cs new file mode 100644 index 00000000..a01755fd --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ArrayTypeTraitExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ArrayTypeTraitExpr : Expr + { + internal ArrayTypeTraitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ArrayTypeTraitExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/AsTypeExpr.cs b/sources/ClangSharp/Cursors/Exprs/AsTypeExpr.cs new file mode 100644 index 00000000..84db41ae --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/AsTypeExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class AsTypeExpr : Expr + { + internal AsTypeExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_AsTypeExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/AtomicExpr.cs b/sources/ClangSharp/Cursors/Exprs/AtomicExpr.cs new file mode 100644 index 00000000..dfc3fff7 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/AtomicExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class AtomicExpr : Expr + { + internal AtomicExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_AtomicExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/BinaryConditionalOperator.cs b/sources/ClangSharp/Cursors/Exprs/BinaryConditionalOperator.cs new file mode 100644 index 00000000..d40b1214 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/BinaryConditionalOperator.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class BinaryConditionalOperator : AbstractConditionalOperator + { + internal BinaryConditionalOperator(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_BinaryConditionalOperator) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/BinaryOperator.cs b/sources/ClangSharp/Cursors/Exprs/BinaryOperator.cs index 0afab815..8000e812 100644 --- a/sources/ClangSharp/Cursors/Exprs/BinaryOperator.cs +++ b/sources/ClangSharp/Cursors/Exprs/BinaryOperator.cs @@ -12,13 +12,17 @@ public class BinaryOperator : Expr private readonly Lazy _lhs; private readonly Lazy _rhs; - internal BinaryOperator(CXCursor handle) : this(handle, CXCursorKind.CXCursor_BinaryOperator) + internal BinaryOperator(CXCursor handle) : this(handle, CXCursorKind.CXCursor_BinaryOperator, CX_StmtClass.CX_StmtClass_BinaryOperator) { } - private protected BinaryOperator(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected BinaryOperator(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) { - Debug.Assert(Children.Where((cursor) => cursor is Expr).Count() == 2); + if ((CX_StmtClass.CX_StmtClass_LastBinaryOperator < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstBinaryOperator)) + { + throw new ArgumentException(nameof(handle)); + } + Debug.Assert(Children.OfType().Count() == 2); _lhs = new Lazy(() => Children.OfType().First()); _rhs = new Lazy(() => Children.OfType().Last()); diff --git a/sources/ClangSharp/Cursors/Exprs/BlockExpr.cs b/sources/ClangSharp/Cursors/Exprs/BlockExpr.cs index fd5ce417..9260e396 100644 --- a/sources/ClangSharp/Cursors/Exprs/BlockExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/BlockExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class BlockExpr : Expr { - internal BlockExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_BlockExpr) + internal BlockExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_BlockExpr, CX_StmtClass.CX_StmtClass_BlockExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/BuiltinBitCastExpr.cs b/sources/ClangSharp/Cursors/Exprs/BuiltinBitCastExpr.cs index ad1d91ea..f70cf552 100644 --- a/sources/ClangSharp/Cursors/Exprs/BuiltinBitCastExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/BuiltinBitCastExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class BuiltinBitCastExpr : ExplicitCastExpr { - internal BuiltinBitCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_BuiltinBitCastExpr) + internal BuiltinBitCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_BuiltinBitCastExpr, CX_StmtClass.CX_StmtClass_BuiltinBitCastExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CStyleCastExpr.cs b/sources/ClangSharp/Cursors/Exprs/CStyleCastExpr.cs index 25274823..ab347c28 100644 --- a/sources/ClangSharp/Cursors/Exprs/CStyleCastExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CStyleCastExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CStyleCastExpr : ExplicitCastExpr { - internal CStyleCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CStyleCastExpr) + internal CStyleCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CStyleCastExpr, CX_StmtClass.CX_StmtClass_CStyleCastExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CUDAKernelCallExpr.cs b/sources/ClangSharp/Cursors/Exprs/CUDAKernelCallExpr.cs new file mode 100644 index 00000000..0dd45c20 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CUDAKernelCallExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CUDAKernelCallExpr : CallExpr + { + internal CUDAKernelCallExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CallExpr, CX_StmtClass.CX_StmtClass_CUDAKernelCallExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXBindTemporaryExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXBindTemporaryExpr.cs new file mode 100644 index 00000000..02b59ab0 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXBindTemporaryExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXBindTemporaryExpr : Expr + { + internal CXXBindTemporaryExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_CXXBindTemporaryExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXBoolLiteralExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXBoolLiteralExpr.cs index e3779e0f..4faa7541 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXBoolLiteralExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXBoolLiteralExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXBoolLiteralExpr : Expr { - internal CXXBoolLiteralExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXBoolLiteralExpr) + internal CXXBoolLiteralExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXBoolLiteralExpr, CX_StmtClass.CX_StmtClass_CXXBoolLiteralExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXConstCastExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXConstCastExpr.cs index 03586f81..4aaea444 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXConstCastExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXConstCastExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXConstCastExpr : CXXNamedCastExpr { - internal CXXConstCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXConstCastExpr) + internal CXXConstCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXConstCastExpr, CX_StmtClass.CX_StmtClass_CXXConstCastExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXConstructExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXConstructExpr.cs new file mode 100644 index 00000000..6b0548ce --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXConstructExpr.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using System; +using ClangSharp.Interop; + +namespace ClangSharp +{ + public class CXXConstructExpr : Expr + { + internal CXXConstructExpr(CXCursor handle) : this(handle, CXCursorKind.CXCursor_CallExpr, CX_StmtClass.CX_StmtClass_CXXConstructExpr) + { + } + + private protected CXXConstructExpr(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) + { + if ((CX_StmtClass.CX_StmtClass_LastCXXConstructExpr < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstCXXConstructExpr)) + { + throw new ArgumentException(nameof(handle)); + } + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXDefaultArgExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXDefaultArgExpr.cs new file mode 100644 index 00000000..62cd3647 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXDefaultArgExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXDefaultArgExpr : Expr + { + internal CXXDefaultArgExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_CXXDefaultArgExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXDefaultInitExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXDefaultInitExpr.cs new file mode 100644 index 00000000..847b6c3f --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXDefaultInitExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXDefaultInitExpr : Expr + { + internal CXXDefaultInitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_CXXDefaultInitExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXDeleteExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXDeleteExpr.cs index 314a6c61..1f731be4 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXDeleteExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXDeleteExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXDeleteExpr : Expr { - internal CXXDeleteExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXDeleteExpr) + internal CXXDeleteExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXDeleteExpr, CX_StmtClass.CX_StmtClass_CXXDeleteExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXDependentScopeMemberExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXDependentScopeMemberExpr.cs new file mode 100644 index 00000000..41a2166f --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXDependentScopeMemberExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXDependentScopeMemberExpr : Expr + { + internal CXXDependentScopeMemberExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_MemberRefExpr, CX_StmtClass.CX_StmtClass_CXXDependentScopeMemberExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXDynamicCastExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXDynamicCastExpr.cs index fac93299..16405a57 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXDynamicCastExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXDynamicCastExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXDynamicCastExpr : CXXNamedCastExpr { - internal CXXDynamicCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXDynamicCastExpr) + internal CXXDynamicCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXDynamicCastExpr, CX_StmtClass.CX_StmtClass_CXXDynamicCastExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXFoldExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXFoldExpr.cs new file mode 100644 index 00000000..d49d1985 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXFoldExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXFoldExpr : Expr + { + internal CXXFoldExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_CXXFoldExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXFunctionalCastExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXFunctionalCastExpr.cs index 995185d7..e28fd7aa 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXFunctionalCastExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXFunctionalCastExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXFunctionalCastExpr : ExplicitCastExpr { - internal CXXFunctionalCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXFunctionalCastExpr) + internal CXXFunctionalCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXFunctionalCastExpr, CX_StmtClass.CX_StmtClass_CXXFunctionalCastExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXInheritedCtorInitExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXInheritedCtorInitExpr.cs new file mode 100644 index 00000000..e7a5d198 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXInheritedCtorInitExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXInheritedCtorInitExpr : Expr + { + internal CXXInheritedCtorInitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CallExpr, CX_StmtClass.CX_StmtClass_CXXInheritedCtorInitExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXMemberCallExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXMemberCallExpr.cs new file mode 100644 index 00000000..600fff3f --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXMemberCallExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXMemberCallExpr : CallExpr + { + internal CXXMemberCallExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CallExpr, CX_StmtClass.CX_StmtClass_CXXMemberCallExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXNamedCastExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXNamedCastExpr.cs index 8a1d61ca..4f44964a 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXNamedCastExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXNamedCastExpr.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class CXXNamedCastExpr : ExplicitCastExpr { - private protected CXXNamedCastExpr(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected CXXNamedCastExpr(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) { + if ((CX_StmtClass.CX_StmtClass_LastCXXNamedCastExpr < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstCXXNamedCastExpr)) + { + throw new ArgumentException(nameof(handle)); + } } } } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXNewExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXNewExpr.cs index 7f83a7c1..bda9f47d 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXNewExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXNewExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXNewExpr : Expr { - internal CXXNewExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXNewExpr) + internal CXXNewExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXNewExpr, CX_StmtClass.CX_StmtClass_CXXNewExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXNoexceptExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXNoexceptExpr.cs new file mode 100644 index 00000000..86607a66 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXNoexceptExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXNoexceptExpr : Expr + { + internal CXXNoexceptExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnaryExpr, CX_StmtClass.CX_StmtClass_CXXNoexceptExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXNullPtrLiteralExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXNullPtrLiteralExpr.cs index d8c609a4..5c34da23 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXNullPtrLiteralExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXNullPtrLiteralExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXNullPtrLiteralExpr : Expr { - internal CXXNullPtrLiteralExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXNullPtrLiteralExpr) + internal CXXNullPtrLiteralExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXNullPtrLiteralExpr, CX_StmtClass.CX_StmtClass_CXXNullPtrLiteralExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXOperatorCallExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXOperatorCallExpr.cs new file mode 100644 index 00000000..bb0c95a2 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXOperatorCallExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXOperatorCallExpr : CallExpr + { + internal CXXOperatorCallExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CallExpr, CX_StmtClass.CX_StmtClass_CXXOperatorCallExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXPseudoDestructorExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXPseudoDestructorExpr.cs new file mode 100644 index 00000000..1351ee48 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXPseudoDestructorExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXPseudoDestructorExpr : Expr + { + internal CXXPseudoDestructorExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_MemberRefExpr, CX_StmtClass.CX_StmtClass_CXXPseudoDestructorExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXReinterpretCastExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXReinterpretCastExpr.cs index ab796bd3..c759c767 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXReinterpretCastExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXReinterpretCastExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXReinterpretCastExpr : CXXNamedCastExpr { - internal CXXReinterpretCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXReinterpretCastExpr) + internal CXXReinterpretCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXReinterpretCastExpr, CX_StmtClass.CX_StmtClass_CXXReinterpretCastExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXScalarValueInitExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXScalarValueInitExpr.cs new file mode 100644 index 00000000..1696ef0a --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXScalarValueInitExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXScalarValueInitExpr : Expr + { + internal CXXScalarValueInitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_CXXScalarValueInitExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXStaticCastExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXStaticCastExpr.cs index cb05eef1..b2f4bc46 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXStaticCastExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXStaticCastExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXStaticCastExpr : CXXNamedCastExpr { - internal CXXStaticCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXStaticCastExpr) + internal CXXStaticCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXStaticCastExpr, CX_StmtClass.CX_StmtClass_CXXStaticCastExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXStdInitializerListExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXStdInitializerListExpr.cs new file mode 100644 index 00000000..f623163e --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXStdInitializerListExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXStdInitializerListExpr : Expr + { + internal CXXStdInitializerListExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_CXXStdInitializerListExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXTemporaryObjectExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXTemporaryObjectExpr.cs new file mode 100644 index 00000000..067f3d15 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXTemporaryObjectExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXTemporaryObjectExpr : CXXConstructExpr + { + internal CXXTemporaryObjectExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CallExpr, CX_StmtClass.CX_StmtClass_CXXTemporaryObjectExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXThisExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXThisExpr.cs index 358dcfd9..0e8f3238 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXThisExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXThisExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXThisExpr : Expr { - internal CXXThisExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXThisExpr) + internal CXXThisExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXThisExpr, CX_StmtClass.CX_StmtClass_CXXThisExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXThrowExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXThrowExpr.cs index b655c151..09237c44 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXThrowExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXThrowExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXThrowExpr : Expr { - internal CXXThrowExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXThrowExpr) + internal CXXThrowExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXThrowExpr, CX_StmtClass.CX_StmtClass_CXXThrowExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXTypeidExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXTypeidExpr.cs index ba84313c..b25e95c2 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXTypeidExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXTypeidExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXTypeidExpr : Expr { - internal CXXTypeidExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXTypeidExpr) + internal CXXTypeidExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXTypeidExpr, CX_StmtClass.CX_StmtClass_CXXTypeidExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXUnresolvedConstructExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXUnresolvedConstructExpr.cs new file mode 100644 index 00000000..efc4e726 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXUnresolvedConstructExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXUnresolvedConstructExpr : Expr + { + internal CXXUnresolvedConstructExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CallExpr, CX_StmtClass.CX_StmtClass_CXXUnresolvedConstructExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CXXUuidofExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXUuidofExpr.cs new file mode 100644 index 00000000..258e12a6 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CXXUuidofExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CXXUuidofExpr : Expr + { + internal CXXUuidofExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_CXXUuidofExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CallExpr.cs b/sources/ClangSharp/Cursors/Exprs/CallExpr.cs index b11a6add..862403af 100644 --- a/sources/ClangSharp/Cursors/Exprs/CallExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CallExpr.cs @@ -6,13 +6,22 @@ namespace ClangSharp { - public sealed class CallExpr : Expr + public class CallExpr : Expr { private readonly Lazy> _args; private readonly Lazy _calleeDecl; - internal CallExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CallExpr) + internal CallExpr(CXCursor handle) : this(handle, CXCursorKind.CXCursor_CallExpr, CX_StmtClass.CX_StmtClass_CallExpr) { + } + + private protected CallExpr(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) + { + if ((CX_StmtClass.CX_StmtClass_LastCallExpr < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstCallExpr)) + { + throw new ArgumentException(nameof(handle)); + } + _args = new Lazy>(() => { var numArgs = NumArgs; var args = new List((int)numArgs); diff --git a/sources/ClangSharp/Cursors/Exprs/CastExpr.cs b/sources/ClangSharp/Cursors/Exprs/CastExpr.cs index 400abec7..da17404d 100644 --- a/sources/ClangSharp/Cursors/Exprs/CastExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CastExpr.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class CastExpr : Expr { - private protected CastExpr(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected CastExpr(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) { + if ((CX_StmtClass.CX_StmtClass_LastCastExpr < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstCastExpr)) + { + throw new ArgumentException(nameof(handle)); + } } } } diff --git a/sources/ClangSharp/Cursors/Exprs/CharacterLiteral.cs b/sources/ClangSharp/Cursors/Exprs/CharacterLiteral.cs index 40d4786f..5e99474f 100644 --- a/sources/ClangSharp/Cursors/Exprs/CharacterLiteral.cs +++ b/sources/ClangSharp/Cursors/Exprs/CharacterLiteral.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CharacterLiteral : Expr { - internal CharacterLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CharacterLiteral) + internal CharacterLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CharacterLiteral, CX_StmtClass.CX_StmtClass_CharacterLiteral) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ChooseExpr.cs b/sources/ClangSharp/Cursors/Exprs/ChooseExpr.cs new file mode 100644 index 00000000..02b0e737 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ChooseExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ChooseExpr : Expr + { + internal ChooseExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ChooseExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CoawaitExpr.cs b/sources/ClangSharp/Cursors/Exprs/CoawaitExpr.cs new file mode 100644 index 00000000..7f8ca4f6 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CoawaitExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CoawaitExpr : CoroutineSuspendExpr + { + internal CoawaitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_CoawaitExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CompoundAssignOperator.cs b/sources/ClangSharp/Cursors/Exprs/CompoundAssignOperator.cs index 86fb49c3..f4c67d34 100644 --- a/sources/ClangSharp/Cursors/Exprs/CompoundAssignOperator.cs +++ b/sources/ClangSharp/Cursors/Exprs/CompoundAssignOperator.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CompoundAssignOperator : BinaryOperator { - internal CompoundAssignOperator(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CompoundAssignOperator) + internal CompoundAssignOperator(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CompoundAssignOperator, CX_StmtClass.CX_StmtClass_CompoundAssignOperator) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/CompoundLiteralExpr.cs b/sources/ClangSharp/Cursors/Exprs/CompoundLiteralExpr.cs index c9647af8..39930402 100644 --- a/sources/ClangSharp/Cursors/Exprs/CompoundLiteralExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CompoundLiteralExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CompoundLiteralExpr : Expr { - internal CompoundLiteralExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CompoundLiteralExpr) + internal CompoundLiteralExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CompoundLiteralExpr, CX_StmtClass.CX_StmtClass_CompoundLiteralExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ConditionalOperator.cs b/sources/ClangSharp/Cursors/Exprs/ConditionalOperator.cs index 4476926b..d5735fc5 100644 --- a/sources/ClangSharp/Cursors/Exprs/ConditionalOperator.cs +++ b/sources/ClangSharp/Cursors/Exprs/ConditionalOperator.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ConditionalOperator : AbstractConditionalOperator { - internal ConditionalOperator(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ConditionalOperator) + internal ConditionalOperator(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ConditionalOperator, CX_StmtClass.CX_StmtClass_ConditionalOperator) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ConstantExpr.cs b/sources/ClangSharp/Cursors/Exprs/ConstantExpr.cs new file mode 100644 index 00000000..9a233e03 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ConstantExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ConstantExpr : FullExpr + { + internal ConstantExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ConstantExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ConvertVectorExpr.cs b/sources/ClangSharp/Cursors/Exprs/ConvertVectorExpr.cs new file mode 100644 index 00000000..c106e005 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ConvertVectorExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ConvertVectorExpr : Expr + { + internal ConvertVectorExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ConvertVectorExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CoroutineSuspendExpr.cs b/sources/ClangSharp/Cursors/Exprs/CoroutineSuspendExpr.cs new file mode 100644 index 00000000..f7891e3c --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CoroutineSuspendExpr.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using System; +using ClangSharp.Interop; + +namespace ClangSharp +{ + public class CoroutineSuspendExpr : Expr + { + private protected CoroutineSuspendExpr(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) + { + if ((CX_StmtClass.CX_StmtClass_LastCoroutineSuspendExpr < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstCoroutineSuspendExpr)) + { + throw new ArgumentException(nameof(handle)); + } + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/CoyieldExpr.cs b/sources/ClangSharp/Cursors/Exprs/CoyieldExpr.cs new file mode 100644 index 00000000..bf005695 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/CoyieldExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CoyieldExpr : CoroutineSuspendExpr + { + internal CoyieldExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_CoyieldExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/DeclRefExpr.cs b/sources/ClangSharp/Cursors/Exprs/DeclRefExpr.cs index 56abd3ff..cbf5a383 100644 --- a/sources/ClangSharp/Cursors/Exprs/DeclRefExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/DeclRefExpr.cs @@ -9,8 +9,13 @@ public sealed class DeclRefExpr : Expr { private readonly Lazy _decl; - internal DeclRefExpr(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + internal DeclRefExpr(CXCursor handle) : base(handle, handle.Kind, CX_StmtClass.CX_StmtClass_DeclRefExpr) { + if ((handle.Kind != CXCursorKind.CXCursor_DeclRefExpr) && (handle.Kind != CXCursorKind.CXCursor_ObjCSelfExpr)) + { + throw new ArgumentException(nameof(handle)); + } + _decl = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Referenced)); } diff --git a/sources/ClangSharp/Cursors/Exprs/DependentCoawaitExpr.cs b/sources/ClangSharp/Cursors/Exprs/DependentCoawaitExpr.cs new file mode 100644 index 00000000..54a1d129 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/DependentCoawaitExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class DependentCoawaitExpr : Expr + { + internal DependentCoawaitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_DependentCoawaitExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/DependentScopeDeclRefExpr.cs b/sources/ClangSharp/Cursors/Exprs/DependentScopeDeclRefExpr.cs new file mode 100644 index 00000000..026277e9 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/DependentScopeDeclRefExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class DependentScopeDeclRefExpr : Expr + { + internal DependentScopeDeclRefExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_DeclRefExpr, CX_StmtClass.CX_StmtClass_DependentScopeDeclRefExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/DesignatedInitExpr.cs b/sources/ClangSharp/Cursors/Exprs/DesignatedInitExpr.cs new file mode 100644 index 00000000..0b3d8fa1 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/DesignatedInitExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class DesignatedInitExpr : Expr + { + internal DesignatedInitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_DesignatedInitExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/DesignatedInitUpdateExpr.cs b/sources/ClangSharp/Cursors/Exprs/DesignatedInitUpdateExpr.cs new file mode 100644 index 00000000..caef0b85 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/DesignatedInitUpdateExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class DesignatedInitUpdateExpr : Expr + { + internal DesignatedInitUpdateExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_DesignatedInitUpdateExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ExplicitCastExpr.cs b/sources/ClangSharp/Cursors/Exprs/ExplicitCastExpr.cs index c60a282d..80988dff 100644 --- a/sources/ClangSharp/Cursors/Exprs/ExplicitCastExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/ExplicitCastExpr.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class ExplicitCastExpr : CastExpr { - private protected ExplicitCastExpr(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected ExplicitCastExpr(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) { + if ((CX_StmtClass.CX_StmtClass_LastExplicitCastExpr < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstExplicitCastExpr)) + { + throw new ArgumentException(nameof(handle)); + } } } } diff --git a/sources/ClangSharp/Cursors/Exprs/Expr.cs b/sources/ClangSharp/Cursors/Exprs/Expr.cs index 55471f21..ffb2df6a 100644 --- a/sources/ClangSharp/Cursors/Exprs/Expr.cs +++ b/sources/ClangSharp/Cursors/Exprs/Expr.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. using System; -using System.Diagnostics; using ClangSharp.Interop; namespace ClangSharp @@ -10,323 +9,16 @@ public class Expr : ValueStmt { private readonly Lazy _type; - private protected Expr(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected Expr(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) { - _type = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Type)); - } - - public Type Type { get; } - - internal static new Expr Create(CXCursor handle) - { - Expr result; - - switch (handle.Kind) + if ((CX_StmtClass.CX_StmtClass_LastExpr < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstExpr)) { - case CXCursorKind.CXCursor_UnexposedExpr: - { - result = new Expr(handle, handle.Kind); - break; - } - - case CXCursorKind.CXCursor_ObjCSelfExpr: - case CXCursorKind.CXCursor_DeclRefExpr: - { - result = new DeclRefExpr(handle, handle.Kind); - break; - } - - case CXCursorKind.CXCursor_MemberRefExpr: - { - result = new MemberExpr(handle); - break; - } - - case CXCursorKind.CXCursor_CallExpr: - { - result = new CallExpr(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCMessageExpr: - { - result = new ObjCMessageExpr(handle); - break; - } - - case CXCursorKind.CXCursor_BlockExpr: - { - result = new BlockExpr(handle); - break; - } - - case CXCursorKind.CXCursor_IntegerLiteral: - { - result = new IntegerLiteral(handle); - break; - } - - case CXCursorKind.CXCursor_FloatingLiteral: - { - result = new FloatingLiteral(handle); - break; - } - - case CXCursorKind.CXCursor_ImaginaryLiteral: - { - result = new ImaginaryLiteral(handle); - break; - } - - case CXCursorKind.CXCursor_StringLiteral: - { - result = new StringLiteral(handle); - break; - } - - case CXCursorKind.CXCursor_CharacterLiteral: - { - result = new CharacterLiteral(handle); - break; - } - - case CXCursorKind.CXCursor_ParenExpr: - { - result = new ParenExpr(handle); - break; - } - - case CXCursorKind.CXCursor_UnaryOperator: - { - result = new UnaryOperator(handle); - break; - } - - case CXCursorKind.CXCursor_ArraySubscriptExpr: - { - result = new ArraySubscriptExpr(handle); - break; - } - - case CXCursorKind.CXCursor_BinaryOperator: - { - result = new BinaryOperator(handle); - break; - } - - case CXCursorKind.CXCursor_CompoundAssignOperator: - { - result = new CompoundAssignOperator(handle); - break; - } - - case CXCursorKind.CXCursor_ConditionalOperator: - { - result = new ConditionalOperator(handle); - break; - } - - case CXCursorKind.CXCursor_CStyleCastExpr: - { - result = new CStyleCastExpr(handle); - break; - } - - case CXCursorKind.CXCursor_CompoundLiteralExpr: - { - result = new CompoundLiteralExpr(handle); - break; - } - - case CXCursorKind.CXCursor_InitListExpr: - { - result = new InitListExpr(handle); - break; - } - - case CXCursorKind.CXCursor_AddrLabelExpr: - { - result = new AddrLabelExpr(handle); - break; - } - - case CXCursorKind.CXCursor_StmtExpr: - { - result = new StmtExpr(handle); - break; - } - - case CXCursorKind.CXCursor_GenericSelectionExpr: - { - result = new GenericSelectionExpr(handle); - break; - } - - case CXCursorKind.CXCursor_GNUNullExpr: - { - result = new GNUNullExpr(handle); - break; - } - - case CXCursorKind.CXCursor_CXXStaticCastExpr: - { - result = new CXXStaticCastExpr(handle); - break; - } - - case CXCursorKind.CXCursor_CXXDynamicCastExpr: - { - result = new CXXDynamicCastExpr(handle); - break; - } - - case CXCursorKind.CXCursor_CXXReinterpretCastExpr: - { - result = new CXXReinterpretCastExpr(handle); - break; - } - - case CXCursorKind.CXCursor_CXXConstCastExpr: - { - result = new CXXConstCastExpr(handle); - break; - } - - case CXCursorKind.CXCursor_CXXFunctionalCastExpr: - { - result = new CXXFunctionalCastExpr(handle); - break; - } - - case CXCursorKind.CXCursor_CXXTypeidExpr: - { - result = new CXXTypeidExpr(handle); - break; - } - - case CXCursorKind.CXCursor_CXXBoolLiteralExpr: - { - result = new CXXBoolLiteralExpr(handle); - break; - } - - case CXCursorKind.CXCursor_CXXNullPtrLiteralExpr: - { - result = new CXXNullPtrLiteralExpr(handle); - break; - } - - case CXCursorKind.CXCursor_CXXThisExpr: - { - result = new CXXThisExpr(handle); - break; - } - - case CXCursorKind.CXCursor_CXXThrowExpr: - { - result = new CXXThrowExpr(handle); - break; - } - - case CXCursorKind.CXCursor_CXXNewExpr: - { - result = new CXXNewExpr(handle); - break; - } - - case CXCursorKind.CXCursor_CXXDeleteExpr: - { - result = new CXXDeleteExpr(handle); - break; - } - - case CXCursorKind.CXCursor_UnaryExpr: - { - result = new UnaryExprOrTypeTraitExpr(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCStringLiteral: - { - result = new ObjCStringLiteral(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCEncodeExpr: - { - result = new ObjCEncodeExpr(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCSelectorExpr: - { - result = new ObjCSelectorExpr(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCProtocolExpr: - { - result = new ObjCProtocolExpr(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCBridgedCastExpr: - { - result = new ObjCBridgedCastExpr(handle); - break; - } - - case CXCursorKind.CXCursor_PackExpansionExpr: - { - result = new PackExpansionExpr(handle); - break; - } - - case CXCursorKind.CXCursor_SizeOfPackExpr: - { - result = new SizeOfPackExpr(handle); - break; - } - - case CXCursorKind.CXCursor_LambdaExpr: - { - result = new LambdaExpr(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCBoolLiteralExpr: - { - result = new ObjCBoolLiteralExpr(handle); - break; - } - - case CXCursorKind.CXCursor_OMPArraySectionExpr: - { - result = new OMPArraySectionExpr(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCAvailabilityCheckExpr: - { - result = new ObjCAvailabilityCheckExpr(handle); - break; - } - - case CXCursorKind.CXCursor_FixedPointLiteral: - { - result = new FixedPointLiteral(handle); - break; - } - - default: - { - Debug.WriteLine($"Unhandled expression kind: {handle.KindSpelling}."); - result = new Expr(handle, handle.Kind); - break; - } + throw new ArgumentException(nameof(handle)); } - return result; + _type = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Type)); } + + public Type Type { get; } } } diff --git a/sources/ClangSharp/Cursors/Exprs/ExprWithCleanups.cs b/sources/ClangSharp/Cursors/Exprs/ExprWithCleanups.cs new file mode 100644 index 00000000..2783478f --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ExprWithCleanups.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ExprWithCleanups : FullExpr + { + internal ExprWithCleanups(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ExprWithCleanups) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ExpressionTraitExpr.cs b/sources/ClangSharp/Cursors/Exprs/ExpressionTraitExpr.cs new file mode 100644 index 00000000..7242c192 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ExpressionTraitExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ExpressionTraitExpr : Expr + { + internal ExpressionTraitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ExpressionTraitExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ExtVectorElementExpr.cs b/sources/ClangSharp/Cursors/Exprs/ExtVectorElementExpr.cs new file mode 100644 index 00000000..69063a65 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ExtVectorElementExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ExtVectorElementExpr : Expr + { + internal ExtVectorElementExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ExtVectorElementExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/FixedPointLiteral.cs b/sources/ClangSharp/Cursors/Exprs/FixedPointLiteral.cs index 553f34a0..c9b9055f 100644 --- a/sources/ClangSharp/Cursors/Exprs/FixedPointLiteral.cs +++ b/sources/ClangSharp/Cursors/Exprs/FixedPointLiteral.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class FixedPointLiteral : Expr { - internal FixedPointLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_FixedPointLiteral) + internal FixedPointLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_FixedPointLiteral, CX_StmtClass.CX_StmtClass_FixedPointLiteral) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/FloatingLiteral.cs b/sources/ClangSharp/Cursors/Exprs/FloatingLiteral.cs index 736233e0..b46902e0 100644 --- a/sources/ClangSharp/Cursors/Exprs/FloatingLiteral.cs +++ b/sources/ClangSharp/Cursors/Exprs/FloatingLiteral.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class FloatingLiteral : Expr { - internal FloatingLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_FloatingLiteral) + internal FloatingLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_FloatingLiteral, CX_StmtClass.CX_StmtClass_FloatingLiteral) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/FullExpr.cs b/sources/ClangSharp/Cursors/Exprs/FullExpr.cs new file mode 100644 index 00000000..9a4652f9 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/FullExpr.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using System; +using ClangSharp.Interop; + +namespace ClangSharp +{ + public class FullExpr : Expr + { + private protected FullExpr(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) + { + if ((CX_StmtClass.CX_StmtClass_LastFullExpr < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstFullExpr)) + { + throw new ArgumentException(nameof(handle)); + } + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/FunctionParmPackExpr.cs b/sources/ClangSharp/Cursors/Exprs/FunctionParmPackExpr.cs new file mode 100644 index 00000000..a469c832 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/FunctionParmPackExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class FunctionParmPackExpr : Expr + { + internal FunctionParmPackExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_DeclRefExpr, CX_StmtClass.CX_StmtClass_FunctionParmPackExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/GNUNullExpr.cs b/sources/ClangSharp/Cursors/Exprs/GNUNullExpr.cs index d265cd4f..f95106ff 100644 --- a/sources/ClangSharp/Cursors/Exprs/GNUNullExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/GNUNullExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class GNUNullExpr : Expr { - internal GNUNullExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_GNUNullExpr) + internal GNUNullExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_GNUNullExpr, CX_StmtClass.CX_StmtClass_GNUNullExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/GenericSelectionExpr.cs b/sources/ClangSharp/Cursors/Exprs/GenericSelectionExpr.cs index b55daec3..78a04a3e 100644 --- a/sources/ClangSharp/Cursors/Exprs/GenericSelectionExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/GenericSelectionExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class GenericSelectionExpr : Expr { - internal GenericSelectionExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_GenericSelectionExpr) + internal GenericSelectionExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_GenericSelectionExpr, CX_StmtClass.CX_StmtClass_GenericSelectionExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ImaginaryLiteral.cs b/sources/ClangSharp/Cursors/Exprs/ImaginaryLiteral.cs index b6bf3e98..c9e5978f 100644 --- a/sources/ClangSharp/Cursors/Exprs/ImaginaryLiteral.cs +++ b/sources/ClangSharp/Cursors/Exprs/ImaginaryLiteral.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ImaginaryLiteral : Expr { - internal ImaginaryLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ImaginaryLiteral) + internal ImaginaryLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ImaginaryLiteral, CX_StmtClass.CX_StmtClass_ImaginaryLiteral) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ImplicitCastExpr.cs b/sources/ClangSharp/Cursors/Exprs/ImplicitCastExpr.cs new file mode 100644 index 00000000..6583019d --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ImplicitCastExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ImplicitCastExpr : CastExpr + { + internal ImplicitCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ImplicitCastExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ImplicitValueInitExpr.cs b/sources/ClangSharp/Cursors/Exprs/ImplicitValueInitExpr.cs new file mode 100644 index 00000000..3ebadd2b --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ImplicitValueInitExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ImplicitValueInitExpr : Expr + { + internal ImplicitValueInitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ImplicitValueInitExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/InitListExpr.cs b/sources/ClangSharp/Cursors/Exprs/InitListExpr.cs index d3ea2169..e8a3ce52 100644 --- a/sources/ClangSharp/Cursors/Exprs/InitListExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/InitListExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class InitListExpr : Expr { - internal InitListExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_InitListExpr) + internal InitListExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_InitListExpr, CX_StmtClass.CX_StmtClass_InitListExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/IntegerLiteral.cs b/sources/ClangSharp/Cursors/Exprs/IntegerLiteral.cs index 713bcb74..1da9f6e1 100644 --- a/sources/ClangSharp/Cursors/Exprs/IntegerLiteral.cs +++ b/sources/ClangSharp/Cursors/Exprs/IntegerLiteral.cs @@ -10,7 +10,7 @@ public sealed class IntegerLiteral : Expr { private readonly Lazy _value; - internal IntegerLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_IntegerLiteral) + internal IntegerLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_IntegerLiteral, CX_StmtClass.CX_StmtClass_IntegerLiteral) { _value = new Lazy(() => { var tokens = Handle.TranslationUnit.Tokenize(Extent); diff --git a/sources/ClangSharp/Cursors/Exprs/LambdaExpr.cs b/sources/ClangSharp/Cursors/Exprs/LambdaExpr.cs index 7346633a..3ae584db 100644 --- a/sources/ClangSharp/Cursors/Exprs/LambdaExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/LambdaExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class LambdaExpr : Expr { - internal LambdaExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_LambdaExpr) + internal LambdaExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_LambdaExpr, CX_StmtClass.CX_StmtClass_LambdaExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/MSPropertyRefExpr.cs b/sources/ClangSharp/Cursors/Exprs/MSPropertyRefExpr.cs new file mode 100644 index 00000000..8c3f05e3 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/MSPropertyRefExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class MSPropertyRefExpr : Expr + { + internal MSPropertyRefExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_MemberRefExpr, CX_StmtClass.CX_StmtClass_MSPropertyRefExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/MSPropertySubscriptExpr.cs b/sources/ClangSharp/Cursors/Exprs/MSPropertySubscriptExpr.cs new file mode 100644 index 00000000..21a63ac5 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/MSPropertySubscriptExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class MSPropertySubscriptExpr : Expr + { + internal MSPropertySubscriptExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ArraySubscriptExpr, CX_StmtClass.CX_StmtClass_MSPropertySubscriptExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/MaterializeTemporaryExpr.cs b/sources/ClangSharp/Cursors/Exprs/MaterializeTemporaryExpr.cs new file mode 100644 index 00000000..e50a4f79 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/MaterializeTemporaryExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class MaterializeTemporaryExpr : Expr + { + internal MaterializeTemporaryExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_MaterializeTemporaryExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/MemberExpr.cs b/sources/ClangSharp/Cursors/Exprs/MemberExpr.cs index 9dfede15..dafa7e42 100644 --- a/sources/ClangSharp/Cursors/Exprs/MemberExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/MemberExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class MemberExpr : Expr { - internal MemberExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_MemberRefExpr) + internal MemberExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_MemberRefExpr, CX_StmtClass.CX_StmtClass_MemberExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/NoInitExpr.cs b/sources/ClangSharp/Cursors/Exprs/NoInitExpr.cs new file mode 100644 index 00000000..442dfa4f --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/NoInitExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class NoInitExpr : Expr + { + internal NoInitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_NoInitExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/OMPArraySectionExpr.cs b/sources/ClangSharp/Cursors/Exprs/OMPArraySectionExpr.cs index a5ae6605..17edb705 100644 --- a/sources/ClangSharp/Cursors/Exprs/OMPArraySectionExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/OMPArraySectionExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPArraySectionExpr : Expr { - internal OMPArraySectionExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPArraySectionExpr) + internal OMPArraySectionExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPArraySectionExpr, CX_StmtClass.CX_StmtClass_OMPArraySectionExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCArrayLiteral.cs b/sources/ClangSharp/Cursors/Exprs/ObjCArrayLiteral.cs new file mode 100644 index 00000000..49780453 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ObjCArrayLiteral.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ObjCArrayLiteral : Expr + { + internal ObjCArrayLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ObjCArrayLiteral) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCAvailabilityCheckExpr.cs b/sources/ClangSharp/Cursors/Exprs/ObjCAvailabilityCheckExpr.cs index b7b79f7e..68b80c74 100644 --- a/sources/ClangSharp/Cursors/Exprs/ObjCAvailabilityCheckExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/ObjCAvailabilityCheckExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCAvailabilityCheckExpr : Expr { - internal ObjCAvailabilityCheckExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAvailabilityCheckExpr) + internal ObjCAvailabilityCheckExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAvailabilityCheckExpr, CX_StmtClass.CX_StmtClass_ObjCAvailabilityCheckExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCBoolLiteralExpr.cs b/sources/ClangSharp/Cursors/Exprs/ObjCBoolLiteralExpr.cs index 932eb512..4f23c497 100644 --- a/sources/ClangSharp/Cursors/Exprs/ObjCBoolLiteralExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/ObjCBoolLiteralExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCBoolLiteralExpr : Expr { - internal ObjCBoolLiteralExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCBoolLiteralExpr) + internal ObjCBoolLiteralExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCBoolLiteralExpr, CX_StmtClass.CX_StmtClass_ObjCBoolLiteralExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCBoxedExpr.cs b/sources/ClangSharp/Cursors/Exprs/ObjCBoxedExpr.cs new file mode 100644 index 00000000..becb62a6 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ObjCBoxedExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ObjCBoxedExpr : Expr + { + internal ObjCBoxedExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ObjCBoxedExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCBridgedCastExpr.cs b/sources/ClangSharp/Cursors/Exprs/ObjCBridgedCastExpr.cs index bb497a28..673fd6d2 100644 --- a/sources/ClangSharp/Cursors/Exprs/ObjCBridgedCastExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/ObjCBridgedCastExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCBridgedCastExpr : ExplicitCastExpr { - internal ObjCBridgedCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCBridgedCastExpr) + internal ObjCBridgedCastExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCBridgedCastExpr, CX_StmtClass.CX_StmtClass_ObjCBridgedCastExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCDictionaryLiteral.cs b/sources/ClangSharp/Cursors/Exprs/ObjCDictionaryLiteral.cs new file mode 100644 index 00000000..841cf48d --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ObjCDictionaryLiteral.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ObjCDictionaryLiteral : Expr + { + internal ObjCDictionaryLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ObjCDictionaryLiteral) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCEncodeExpr.cs b/sources/ClangSharp/Cursors/Exprs/ObjCEncodeExpr.cs index 70968291..1905a419 100644 --- a/sources/ClangSharp/Cursors/Exprs/ObjCEncodeExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/ObjCEncodeExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCEncodeExpr : Expr { - internal ObjCEncodeExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCEncodeExpr) + internal ObjCEncodeExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCEncodeExpr, CX_StmtClass.CX_StmtClass_ObjCEncodeExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCIndirectCopyRestoreExpr.cs b/sources/ClangSharp/Cursors/Exprs/ObjCIndirectCopyRestoreExpr.cs new file mode 100644 index 00000000..3c322d0e --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ObjCIndirectCopyRestoreExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ObjCIndirectCopyRestoreExpr : Expr + { + internal ObjCIndirectCopyRestoreExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ObjCIndirectCopyRestoreExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCIsaExpr.cs b/sources/ClangSharp/Cursors/Exprs/ObjCIsaExpr.cs new file mode 100644 index 00000000..ce34e592 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ObjCIsaExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ObjCIsaExpr : Expr + { + internal ObjCIsaExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_MemberRefExpr, CX_StmtClass.CX_StmtClass_ObjCIsaExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCIvarRefExpr.cs b/sources/ClangSharp/Cursors/Exprs/ObjCIvarRefExpr.cs new file mode 100644 index 00000000..250b99b7 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ObjCIvarRefExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ObjCIvarRefExpr : Expr + { + internal ObjCIvarRefExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_MemberRefExpr, CX_StmtClass.CX_StmtClass_ObjCIvarRefExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCMessageExpr.cs b/sources/ClangSharp/Cursors/Exprs/ObjCMessageExpr.cs index e3caedc7..9d630daf 100644 --- a/sources/ClangSharp/Cursors/Exprs/ObjCMessageExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/ObjCMessageExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCMessageExpr : Expr { - internal ObjCMessageExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCMessageExpr) + internal ObjCMessageExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCMessageExpr, CX_StmtClass.CX_StmtClass_ObjCMessageExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCPropertyRefExpr.cs b/sources/ClangSharp/Cursors/Exprs/ObjCPropertyRefExpr.cs new file mode 100644 index 00000000..42064258 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ObjCPropertyRefExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ObjCPropertyRefExpr : Expr + { + internal ObjCPropertyRefExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_MemberRefExpr, CX_StmtClass.CX_StmtClass_ObjCPropertyRefExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCProtocolExpr.cs b/sources/ClangSharp/Cursors/Exprs/ObjCProtocolExpr.cs index c577602f..dc67fc4d 100644 --- a/sources/ClangSharp/Cursors/Exprs/ObjCProtocolExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/ObjCProtocolExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCProtocolExpr : Expr { - internal ObjCProtocolExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCProtocolExpr) + internal ObjCProtocolExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCProtocolExpr, CX_StmtClass.CX_StmtClass_ObjCProtocolExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCSelectorExpr.cs b/sources/ClangSharp/Cursors/Exprs/ObjCSelectorExpr.cs index 12775222..601901f4 100644 --- a/sources/ClangSharp/Cursors/Exprs/ObjCSelectorExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/ObjCSelectorExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCSelectorExpr : Expr { - internal ObjCSelectorExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCSelectorExpr) + internal ObjCSelectorExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCSelectorExpr, CX_StmtClass.CX_StmtClass_ObjCSelectorExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCStringLiteral.cs b/sources/ClangSharp/Cursors/Exprs/ObjCStringLiteral.cs index 75b77edb..71efde71 100644 --- a/sources/ClangSharp/Cursors/Exprs/ObjCStringLiteral.cs +++ b/sources/ClangSharp/Cursors/Exprs/ObjCStringLiteral.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCStringLiteral : Expr { - internal ObjCStringLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCStringLiteral) + internal ObjCStringLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCStringLiteral, CX_StmtClass.CX_StmtClass_ObjCStringLiteral) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ObjCSubscriptRefExpr.cs b/sources/ClangSharp/Cursors/Exprs/ObjCSubscriptRefExpr.cs new file mode 100644 index 00000000..a5cac9d0 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ObjCSubscriptRefExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ObjCSubscriptRefExpr : Expr + { + internal ObjCSubscriptRefExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ObjCSubscriptRefExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/OffsetOfExpr.cs b/sources/ClangSharp/Cursors/Exprs/OffsetOfExpr.cs new file mode 100644 index 00000000..f36251db --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/OffsetOfExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class OffsetOfExpr : Expr + { + internal OffsetOfExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_OffsetOfExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/OpaqueValueExpr.cs b/sources/ClangSharp/Cursors/Exprs/OpaqueValueExpr.cs new file mode 100644 index 00000000..32287df3 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/OpaqueValueExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class OpaqueValueExpr : Expr + { + internal OpaqueValueExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_OpaqueValueExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/OverloadExpr.cs b/sources/ClangSharp/Cursors/Exprs/OverloadExpr.cs new file mode 100644 index 00000000..a68509c9 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/OverloadExpr.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using System; +using ClangSharp.Interop; + +namespace ClangSharp +{ + public class OverloadExpr : Expr + { + private protected OverloadExpr(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) + { + if ((CX_StmtClass.CX_StmtClass_LastOverloadExpr < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstOverloadExpr)) + { + throw new ArgumentException(nameof(handle)); + } + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/PackExpansionExpr.cs b/sources/ClangSharp/Cursors/Exprs/PackExpansionExpr.cs index b3cae564..99e80a28 100644 --- a/sources/ClangSharp/Cursors/Exprs/PackExpansionExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/PackExpansionExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class PackExpansionExpr : Expr { - internal PackExpansionExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_PackExpansionExpr) + internal PackExpansionExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_PackExpansionExpr, CX_StmtClass.CX_StmtClass_PackExpansionExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/ParenExpr.cs b/sources/ClangSharp/Cursors/Exprs/ParenExpr.cs index caf0912e..3fd8dee6 100644 --- a/sources/ClangSharp/Cursors/Exprs/ParenExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/ParenExpr.cs @@ -10,7 +10,7 @@ public sealed class ParenExpr : Expr { private readonly Lazy _subExpr; - internal ParenExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ParenExpr) + internal ParenExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ParenExpr, CX_StmtClass.CX_StmtClass_ParenExpr) { _subExpr = new Lazy(() => Children.OfType().Single()); } diff --git a/sources/ClangSharp/Cursors/Exprs/ParenListExpr.cs b/sources/ClangSharp/Cursors/Exprs/ParenListExpr.cs new file mode 100644 index 00000000..86391762 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ParenListExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ParenListExpr : Expr + { + internal ParenListExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ParenListExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/PredefinedExpr.cs b/sources/ClangSharp/Cursors/Exprs/PredefinedExpr.cs new file mode 100644 index 00000000..b7b1ba8b --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/PredefinedExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class PredefinedExpr : Expr + { + internal PredefinedExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_PredefinedExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/PseudoObjectExpr.cs b/sources/ClangSharp/Cursors/Exprs/PseudoObjectExpr.cs new file mode 100644 index 00000000..a5e84496 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/PseudoObjectExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class PseudoObjectExpr : Expr + { + internal PseudoObjectExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_PseudoObjectExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ShuffleVectorExpr.cs b/sources/ClangSharp/Cursors/Exprs/ShuffleVectorExpr.cs new file mode 100644 index 00000000..cbcadf5d --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/ShuffleVectorExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ShuffleVectorExpr : Expr + { + internal ShuffleVectorExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ShuffleVectorExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/SizeOfPackExpr.cs b/sources/ClangSharp/Cursors/Exprs/SizeOfPackExpr.cs index 29ce6b9a..4527eb3a 100644 --- a/sources/ClangSharp/Cursors/Exprs/SizeOfPackExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/SizeOfPackExpr.cs @@ -9,7 +9,7 @@ public sealed class SizeOfPackExpr : Expr { private readonly Lazy _pack; - internal SizeOfPackExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_SizeOfPackExpr) + internal SizeOfPackExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_SizeOfPackExpr, CX_StmtClass.CX_StmtClass_SizeOfPackExpr) { _pack = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Referenced)); } diff --git a/sources/ClangSharp/Cursors/Exprs/SourceLocExpr.cs b/sources/ClangSharp/Cursors/Exprs/SourceLocExpr.cs new file mode 100644 index 00000000..1faf444a --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/SourceLocExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class SourceLocExpr : Expr + { + internal SourceLocExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_SourceLocExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/StmtExpr.cs b/sources/ClangSharp/Cursors/Exprs/StmtExpr.cs index 04e07023..daf98e3f 100644 --- a/sources/ClangSharp/Cursors/Exprs/StmtExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/StmtExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class StmtExpr : Expr { - internal StmtExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_StmtExpr) + internal StmtExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_StmtExpr, CX_StmtClass.CX_StmtClass_StmtExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/StringLiteral.cs b/sources/ClangSharp/Cursors/Exprs/StringLiteral.cs index caa82555..fcccfd2e 100644 --- a/sources/ClangSharp/Cursors/Exprs/StringLiteral.cs +++ b/sources/ClangSharp/Cursors/Exprs/StringLiteral.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class StringLiteral : Expr { - internal StringLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_StringLiteral) + internal StringLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_StringLiteral, CX_StmtClass.CX_StmtClass_StringLiteral) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/SubstNonTypeTemplateParmExpr.cs b/sources/ClangSharp/Cursors/Exprs/SubstNonTypeTemplateParmExpr.cs new file mode 100644 index 00000000..d420979f --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/SubstNonTypeTemplateParmExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class SubstNonTypeTemplateParmExpr : Expr + { + internal SubstNonTypeTemplateParmExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_DeclRefExpr, CX_StmtClass.CX_StmtClass_SubstNonTypeTemplateParmExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/SubstNonTypeTemplateParmPackExpr.cs b/sources/ClangSharp/Cursors/Exprs/SubstNonTypeTemplateParmPackExpr.cs new file mode 100644 index 00000000..b6faa9ed --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/SubstNonTypeTemplateParmPackExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class SubstNonTypeTemplateParmPackExpr : Expr + { + internal SubstNonTypeTemplateParmPackExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_DeclRefExpr, CX_StmtClass.CX_StmtClass_SubstNonTypeTemplateParmPackExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/TypeTraitExpr.cs b/sources/ClangSharp/Cursors/Exprs/TypeTraitExpr.cs new file mode 100644 index 00000000..31dd36f7 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/TypeTraitExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class TypeTraitExpr : Expr + { + internal TypeTraitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_TypeTraitExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/TypoExpr.cs b/sources/ClangSharp/Cursors/Exprs/TypoExpr.cs new file mode 100644 index 00000000..d7e58f39 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/TypoExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class TypoExpr : Expr + { + internal TypoExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_DeclRefExpr, CX_StmtClass.CX_StmtClass_TypoExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/UnaryExprOrTypeTraitExpr.cs b/sources/ClangSharp/Cursors/Exprs/UnaryExprOrTypeTraitExpr.cs index baff9d35..8e9876e8 100644 --- a/sources/ClangSharp/Cursors/Exprs/UnaryExprOrTypeTraitExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/UnaryExprOrTypeTraitExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class UnaryExprOrTypeTraitExpr : Expr { - internal UnaryExprOrTypeTraitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnaryExpr) + internal UnaryExprOrTypeTraitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnaryExpr, CX_StmtClass.CX_StmtClass_UnaryExprOrTypeTraitExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/UnaryOperator.cs b/sources/ClangSharp/Cursors/Exprs/UnaryOperator.cs index 954d45db..3afde240 100644 --- a/sources/ClangSharp/Cursors/Exprs/UnaryOperator.cs +++ b/sources/ClangSharp/Cursors/Exprs/UnaryOperator.cs @@ -10,7 +10,7 @@ public sealed class UnaryOperator : Expr { private readonly Lazy _subExpr; - internal UnaryOperator(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnaryOperator) + internal UnaryOperator(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnaryOperator, CX_StmtClass.CX_StmtClass_UnaryOperator) { _subExpr = new Lazy(() => Children.OfType().Single()); } diff --git a/sources/ClangSharp/Cursors/Exprs/UnresolvedLookupExpr.cs b/sources/ClangSharp/Cursors/Exprs/UnresolvedLookupExpr.cs new file mode 100644 index 00000000..fa185d60 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/UnresolvedLookupExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class UnresolvedLookupExpr : OverloadExpr + { + internal UnresolvedLookupExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_DeclRefExpr, CX_StmtClass.CX_StmtClass_UnresolvedLookupExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/UnresolvedMemberExpr.cs b/sources/ClangSharp/Cursors/Exprs/UnresolvedMemberExpr.cs new file mode 100644 index 00000000..c5eddcdd --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/UnresolvedMemberExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class UnresolvedMemberExpr : OverloadExpr + { + internal UnresolvedMemberExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_MemberRefExpr, CX_StmtClass.CX_StmtClass_UnresolvedMemberExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/UserDefinedLiteral.cs b/sources/ClangSharp/Cursors/Exprs/UserDefinedLiteral.cs new file mode 100644 index 00000000..b3446833 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/UserDefinedLiteral.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class UserDefinedLiteral : CallExpr + { + internal UserDefinedLiteral(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CallExpr, CX_StmtClass.CX_StmtClass_UserDefinedLiteral) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/VAArgExpr.cs b/sources/ClangSharp/Cursors/Exprs/VAArgExpr.cs new file mode 100644 index 00000000..16d9d043 --- /dev/null +++ b/sources/ClangSharp/Cursors/Exprs/VAArgExpr.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class VAArgExpr : Expr + { + internal VAArgExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_VAArgExpr) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Preprocessings/PreprocessedEntity.cs b/sources/ClangSharp/Cursors/Preprocessings/PreprocessedEntity.cs index b6343e32..3f891590 100644 --- a/sources/ClangSharp/Cursors/Preprocessings/PreprocessedEntity.cs +++ b/sources/ClangSharp/Cursors/Preprocessings/PreprocessedEntity.cs @@ -7,7 +7,7 @@ namespace ClangSharp { public class PreprocessedEntity : Cursor { - private protected PreprocessedEntity(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected PreprocessedEntity(CXCursor handle, CXCursorKind expectedCursorKind) : base(handle, expectedCursorKind) { } diff --git a/sources/ClangSharp/Cursors/Preprocessings/PreprocessingDirective.cs b/sources/ClangSharp/Cursors/Preprocessings/PreprocessingDirective.cs index 5ebdb02d..c834d8e3 100644 --- a/sources/ClangSharp/Cursors/Preprocessings/PreprocessingDirective.cs +++ b/sources/ClangSharp/Cursors/Preprocessings/PreprocessingDirective.cs @@ -9,7 +9,7 @@ public class PreprocessingDirective : PreprocessedEntity internal PreprocessingDirective(CXCursor handle) : this(handle, CXCursorKind.CXCursor_PreprocessingDirective) { } - private protected PreprocessingDirective(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected PreprocessingDirective(CXCursor handle, CXCursorKind expectedCursorKind) : base(handle, expectedCursorKind) { } } diff --git a/sources/ClangSharp/Cursors/Refs/Ref.cs b/sources/ClangSharp/Cursors/Refs/Ref.cs index fcc2584e..334eddbd 100644 --- a/sources/ClangSharp/Cursors/Refs/Ref.cs +++ b/sources/ClangSharp/Cursors/Refs/Ref.cs @@ -10,7 +10,7 @@ public class Ref : Cursor { private readonly Lazy _type; - private protected Ref(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected Ref(CXCursor handle, CXCursorKind expectedCursorKind) : base(handle, expectedCursorKind) { _type = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Type)); } diff --git a/sources/ClangSharp/Cursors/Stmts/AsmStmt.cs b/sources/ClangSharp/Cursors/Stmts/AsmStmt.cs index 4e7dc908..fdaf6714 100644 --- a/sources/ClangSharp/Cursors/Stmts/AsmStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/AsmStmt.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class AsmStmt : Stmt { - private protected AsmStmt(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected AsmStmt(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) { + if ((CX_StmtClass.CX_StmtClass_LastAsmStmt < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstAsmStmt)) + { + throw new ArgumentException(nameof(handle)); + } } } } diff --git a/sources/ClangSharp/Cursors/Stmts/AttributedStmt.cs b/sources/ClangSharp/Cursors/Stmts/AttributedStmt.cs new file mode 100644 index 00000000..18f44325 --- /dev/null +++ b/sources/ClangSharp/Cursors/Stmts/AttributedStmt.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class AttributedStmt : ValueStmt + { + internal AttributedStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedStmt, CX_StmtClass.CX_StmtClass_AttributedStmt) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Stmts/BreakStmt.cs b/sources/ClangSharp/Cursors/Stmts/BreakStmt.cs index 1e18c653..4278d253 100644 --- a/sources/ClangSharp/Cursors/Stmts/BreakStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/BreakStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class BreakStmt : Stmt { - internal BreakStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_BreakStmt) + internal BreakStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_BreakStmt, CX_StmtClass.CX_StmtClass_BreakStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/CXXCatchStmt.cs b/sources/ClangSharp/Cursors/Stmts/CXXCatchStmt.cs index 9fa8c6a2..aef43f97 100644 --- a/sources/ClangSharp/Cursors/Stmts/CXXCatchStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/CXXCatchStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXCatchStmt : Stmt { - internal CXXCatchStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXCatchStmt) + internal CXXCatchStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXCatchStmt, CX_StmtClass.CX_StmtClass_CXXCatchStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/CXXForRangeStmt.cs b/sources/ClangSharp/Cursors/Stmts/CXXForRangeStmt.cs index 54259c22..e994736b 100644 --- a/sources/ClangSharp/Cursors/Stmts/CXXForRangeStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/CXXForRangeStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXForRangeStmt : Stmt { - internal CXXForRangeStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXForRangeStmt) + internal CXXForRangeStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXForRangeStmt, CX_StmtClass.CX_StmtClass_CXXForRangeStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/CXXTryStmt.cs b/sources/ClangSharp/Cursors/Stmts/CXXTryStmt.cs index 0a397f6b..776b0257 100644 --- a/sources/ClangSharp/Cursors/Stmts/CXXTryStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/CXXTryStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CXXTryStmt : Stmt { - internal CXXTryStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXTryStmt) + internal CXXTryStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXTryStmt, CX_StmtClass.CX_StmtClass_CXXTryStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/CapturedStmt.cs b/sources/ClangSharp/Cursors/Stmts/CapturedStmt.cs new file mode 100644 index 00000000..42862ccd --- /dev/null +++ b/sources/ClangSharp/Cursors/Stmts/CapturedStmt.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CapturedStmt : Stmt + { + internal CapturedStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedStmt, CX_StmtClass.CX_StmtClass_CapturedStmt) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Stmts/CaseStmt.cs b/sources/ClangSharp/Cursors/Stmts/CaseStmt.cs index 0ae1ff48..2248e215 100644 --- a/sources/ClangSharp/Cursors/Stmts/CaseStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/CaseStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class CaseStmt : SwitchCase { - internal CaseStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CaseStmt) + internal CaseStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CaseStmt, CX_StmtClass.CX_StmtClass_CaseStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/CompoundStmt.cs b/sources/ClangSharp/Cursors/Stmts/CompoundStmt.cs index c6c181bd..c6fe500e 100644 --- a/sources/ClangSharp/Cursors/Stmts/CompoundStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/CompoundStmt.cs @@ -7,7 +7,7 @@ namespace ClangSharp { public sealed class CompoundStmt : Stmt { - public CompoundStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CompoundStmt) + public CompoundStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CompoundStmt, CX_StmtClass.CX_StmtClass_CompoundStmt) { } diff --git a/sources/ClangSharp/Cursors/Stmts/ContinueStmt.cs b/sources/ClangSharp/Cursors/Stmts/ContinueStmt.cs index 6e9623ea..ff26ce42 100644 --- a/sources/ClangSharp/Cursors/Stmts/ContinueStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ContinueStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ContinueStmt : Stmt { - internal ContinueStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ContinueStmt) + internal ContinueStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ContinueStmt, CX_StmtClass.CX_StmtClass_ContinueStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/CoreturnStmt.cs b/sources/ClangSharp/Cursors/Stmts/CoreturnStmt.cs new file mode 100644 index 00000000..b2083f1e --- /dev/null +++ b/sources/ClangSharp/Cursors/Stmts/CoreturnStmt.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CoreturnStmt : Stmt + { + internal CoreturnStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedStmt, CX_StmtClass.CX_StmtClass_CoreturnStmt) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Stmts/CoroutineBodyStmt.cs b/sources/ClangSharp/Cursors/Stmts/CoroutineBodyStmt.cs new file mode 100644 index 00000000..2a77ca8b --- /dev/null +++ b/sources/ClangSharp/Cursors/Stmts/CoroutineBodyStmt.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class CoroutineBodyStmt : Stmt + { + internal CoroutineBodyStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedStmt, CX_StmtClass.CX_StmtClass_CoroutineBodyStmt) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Stmts/DeclStmt.cs b/sources/ClangSharp/Cursors/Stmts/DeclStmt.cs index a706ebc5..fae8bac8 100644 --- a/sources/ClangSharp/Cursors/Stmts/DeclStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/DeclStmt.cs @@ -11,7 +11,7 @@ public sealed class DeclStmt : Stmt { private readonly Lazy> _decls; - internal DeclStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_DeclStmt) + internal DeclStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_DeclStmt, CX_StmtClass.CX_StmtClass_DeclStmt) { _decls = new Lazy>(() => CursorChildren.OfType().ToList()); } diff --git a/sources/ClangSharp/Cursors/Stmts/DefaultStmt.cs b/sources/ClangSharp/Cursors/Stmts/DefaultStmt.cs index 12b5f794..c6e6ad37 100644 --- a/sources/ClangSharp/Cursors/Stmts/DefaultStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/DefaultStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class DefaultStmt : SwitchCase { - internal DefaultStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_DefaultStmt) + internal DefaultStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_DefaultStmt, CX_StmtClass.CX_StmtClass_DefaultStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/DoStmt.cs b/sources/ClangSharp/Cursors/Stmts/DoStmt.cs index a19bed1f..bd82b86e 100644 --- a/sources/ClangSharp/Cursors/Stmts/DoStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/DoStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class DoStmt : Stmt { - internal DoStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_DoStmt) + internal DoStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_DoStmt, CX_StmtClass.CX_StmtClass_DoStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/ForStmt.cs b/sources/ClangSharp/Cursors/Stmts/ForStmt.cs index 69c926fe..4fa4b713 100644 --- a/sources/ClangSharp/Cursors/Stmts/ForStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ForStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ForStmt : Stmt { - internal ForStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ForStmt) + internal ForStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ForStmt, CX_StmtClass.CX_StmtClass_ForStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/GCCAsmStmt.cs b/sources/ClangSharp/Cursors/Stmts/GCCAsmStmt.cs index 476f605f..42a536d7 100644 --- a/sources/ClangSharp/Cursors/Stmts/GCCAsmStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/GCCAsmStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class GCCAsmStmt : AsmStmt { - internal GCCAsmStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_GCCAsmStmt) + internal GCCAsmStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_GCCAsmStmt, CX_StmtClass.CX_StmtClass_GCCAsmStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/GotoStmt.cs b/sources/ClangSharp/Cursors/Stmts/GotoStmt.cs index 5a840376..25dd93a2 100644 --- a/sources/ClangSharp/Cursors/Stmts/GotoStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/GotoStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class GotoStmt : Stmt { - internal GotoStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_GotoStmt) + internal GotoStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_GotoStmt, CX_StmtClass.CX_StmtClass_GotoStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/IfStmt.cs b/sources/ClangSharp/Cursors/Stmts/IfStmt.cs index cf1ae5cc..cdead8d5 100644 --- a/sources/ClangSharp/Cursors/Stmts/IfStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/IfStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class IfStmt : Stmt { - internal IfStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_IfStmt) + internal IfStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_IfStmt, CX_StmtClass.CX_StmtClass_IfStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/IndirectGotoStmt.cs b/sources/ClangSharp/Cursors/Stmts/IndirectGotoStmt.cs index 9bbad19b..896d0d9a 100644 --- a/sources/ClangSharp/Cursors/Stmts/IndirectGotoStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/IndirectGotoStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class IndirectGotoStmt : Stmt { - internal IndirectGotoStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_IndirectGotoStmt) + internal IndirectGotoStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_IndirectGotoStmt, CX_StmtClass.CX_StmtClass_IndirectGotoStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/LabelStmt.cs b/sources/ClangSharp/Cursors/Stmts/LabelStmt.cs index 6262f426..d069544d 100644 --- a/sources/ClangSharp/Cursors/Stmts/LabelStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/LabelStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class LabelStmt : ValueStmt { - internal LabelStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_LabelStmt) + internal LabelStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_LabelStmt, CX_StmtClass.CX_StmtClass_LabelStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/MSAsmStmt.cs b/sources/ClangSharp/Cursors/Stmts/MSAsmStmt.cs index df879fb9..89fa610b 100644 --- a/sources/ClangSharp/Cursors/Stmts/MSAsmStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/MSAsmStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class MSAsmStmt : AsmStmt { - internal MSAsmStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_MSAsmStmt) + internal MSAsmStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_MSAsmStmt, CX_StmtClass.CX_StmtClass_MSAsmStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/MSDependentExistsStmt.cs b/sources/ClangSharp/Cursors/Stmts/MSDependentExistsStmt.cs new file mode 100644 index 00000000..5ca89519 --- /dev/null +++ b/sources/ClangSharp/Cursors/Stmts/MSDependentExistsStmt.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class MSDependentExistsStmt : Stmt + { + internal MSDependentExistsStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedStmt, CX_StmtClass.CX_StmtClass_MSDependentExistsStmt) + { + } + } +} diff --git a/sources/ClangSharp/Cursors/Stmts/NullStmt.cs b/sources/ClangSharp/Cursors/Stmts/NullStmt.cs index 95636f1c..eda7a900 100644 --- a/sources/ClangSharp/Cursors/Stmts/NullStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/NullStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class NullStmt : Stmt { - internal NullStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_NullStmt) + internal NullStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_NullStmt, CX_StmtClass.CX_StmtClass_NullStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPAtomicDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPAtomicDirective.cs index ec35c564..bbcdeec1 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPAtomicDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPAtomicDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPAtomicDirective : OMPExecutableDirective { - internal OMPAtomicDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPAtomicDirective) + internal OMPAtomicDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPAtomicDirective, CX_StmtClass.CX_StmtClass_OMPAtomicDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPBarrierDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPBarrierDirective.cs index a1695b6a..90f749b4 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPBarrierDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPBarrierDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPBarrierDirective : OMPExecutableDirective { - internal OMPBarrierDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPBarrierDirective) + internal OMPBarrierDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPBarrierDirective, CX_StmtClass.CX_StmtClass_OMPBarrierDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPCancelDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPCancelDirective.cs index 18a8a6ec..b6bc2697 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPCancelDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPCancelDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPCancelDirective : OMPExecutableDirective { - internal OMPCancelDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPCancelDirective) + internal OMPCancelDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPCancelDirective, CX_StmtClass.CX_StmtClass_OMPCancelDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPCancellationPointDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPCancellationPointDirective.cs index b18a79cc..14e3b620 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPCancellationPointDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPCancellationPointDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPCancellationPointDirective : OMPExecutableDirective { - internal OMPCancellationPointDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPCancellationPointDirective) + internal OMPCancellationPointDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPCancellationPointDirective, CX_StmtClass.CX_StmtClass_OMPCancellationPointDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPCriticalDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPCriticalDirective.cs index 73637229..d97bc024 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPCriticalDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPCriticalDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPCriticalDirective : OMPExecutableDirective { - internal OMPCriticalDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPCriticalDirective) + internal OMPCriticalDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPCriticalDirective, CX_StmtClass.CX_StmtClass_OMPCriticalDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPDistributeDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPDistributeDirective.cs index 2e549ca7..d5158618 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPDistributeDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPDistributeDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPDistributeDirective : OMPLoopDirective { - internal OMPDistributeDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPDistributeDirective) + internal OMPDistributeDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPDistributeDirective, CX_StmtClass.CX_StmtClass_OMPDistributeDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPDistributeParallelForDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPDistributeParallelForDirective.cs index 97bdc695..db455158 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPDistributeParallelForDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPDistributeParallelForDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPDistributeParallelForDirective : OMPLoopDirective { - internal OMPDistributeParallelForDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPDistributeParallelForDirective) + internal OMPDistributeParallelForDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPDistributeParallelForDirective, CX_StmtClass.CX_StmtClass_OMPDistributeParallelForDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPDistributeParallelForSimdDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPDistributeParallelForSimdDirective.cs index 53faf9a1..ca3a8e1e 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPDistributeParallelForSimdDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPDistributeParallelForSimdDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPDistributeParallelForSimdDirective : OMPLoopDirective { - internal OMPDistributeParallelForSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPDistributeParallelForSimdDirective) + internal OMPDistributeParallelForSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPDistributeParallelForSimdDirective, CX_StmtClass.CX_StmtClass_OMPDistributeParallelForSimdDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPDistributeSimdDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPDistributeSimdDirective.cs index 3f01025e..08533074 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPDistributeSimdDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPDistributeSimdDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPDistributeSimdDirective : OMPLoopDirective { - internal OMPDistributeSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPDistributeSimdDirective) + internal OMPDistributeSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPDistributeSimdDirective, CX_StmtClass.CX_StmtClass_OMPDistributeSimdDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPExecutableDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPExecutableDirective.cs index d3b9c70f..53244b68 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPExecutableDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPExecutableDirective.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class OMPExecutableDirective : Stmt { - private protected OMPExecutableDirective(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected OMPExecutableDirective(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) { + if ((CX_StmtClass.CX_StmtClass_LastOMPExecutableDirective < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstOMPExecutableDirective)) + { + throw new ArgumentException(nameof(handle)); + } } } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPFlushDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPFlushDirective.cs index f4258d35..0619ab0a 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPFlushDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPFlushDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPFlushDirective : OMPExecutableDirective { - internal OMPFlushDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPFlushDirective) + internal OMPFlushDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPFlushDirective, CX_StmtClass.CX_StmtClass_OMPFlushDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPForDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPForDirective.cs index 2a5c9826..694dd0cf 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPForDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPForDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPForDirective : OMPLoopDirective { - internal OMPForDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPForDirective) + internal OMPForDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPForDirective, CX_StmtClass.CX_StmtClass_OMPForDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPForSimdDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPForSimdDirective.cs index 0b247a59..24d3a67c 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPForSimdDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPForSimdDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPForSimdDirective : OMPLoopDirective { - internal OMPForSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPForSimdDirective) + internal OMPForSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPForSimdDirective, CX_StmtClass.CX_StmtClass_OMPForSimdDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPLoopDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPLoopDirective.cs index 4c9c0086..17243ef1 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPLoopDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPLoopDirective.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class OMPLoopDirective : OMPExecutableDirective { - private protected OMPLoopDirective(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected OMPLoopDirective(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) { + if ((CX_StmtClass.CX_StmtClass_LastOMPLoopDirective < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstOMPLoopDirective)) + { + throw new ArgumentException(nameof(handle)); + } } } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPMasterDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPMasterDirective.cs index ce3830f9..e09909c1 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPMasterDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPMasterDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPMasterDirective : OMPExecutableDirective { - internal OMPMasterDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPMasterDirective) + internal OMPMasterDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPMasterDirective, CX_StmtClass.CX_StmtClass_OMPMasterDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPOrderedDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPOrderedDirective.cs index 211617f3..81b86e60 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPOrderedDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPOrderedDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPOrderedDirective : OMPExecutableDirective { - internal OMPOrderedDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPOrderedDirective) + internal OMPOrderedDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPOrderedDirective, CX_StmtClass.CX_StmtClass_OMPOrderedDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPParallelDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPParallelDirective.cs index f396d336..3a031868 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPParallelDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPParallelDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPParallelDirective : OMPExecutableDirective { - internal OMPParallelDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPParallelDirective) + internal OMPParallelDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPParallelDirective, CX_StmtClass.CX_StmtClass_OMPParallelDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPParallelForDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPParallelForDirective.cs index 3665e7df..a3ae1aed 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPParallelForDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPParallelForDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPParallelForDirective : OMPLoopDirective { - internal OMPParallelForDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPParallelForDirective) + internal OMPParallelForDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPParallelForDirective, CX_StmtClass.CX_StmtClass_OMPParallelForDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPParallelForSimdDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPParallelForSimdDirective.cs index fe1f8724..bea924da 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPParallelForSimdDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPParallelForSimdDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPParallelForSimdDirective : OMPLoopDirective { - internal OMPParallelForSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPParallelForSimdDirective) + internal OMPParallelForSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPParallelForSimdDirective, CX_StmtClass.CX_StmtClass_OMPParallelForSimdDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPParallelSectionsDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPParallelSectionsDirective.cs index e6e81a1c..44c346bd 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPParallelSectionsDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPParallelSectionsDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPParallelSectionsDirective : OMPExecutableDirective { - internal OMPParallelSectionsDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPParallelSectionsDirective) + internal OMPParallelSectionsDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPParallelSectionsDirective, CX_StmtClass.CX_StmtClass_OMPParallelSectionsDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPSectionDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPSectionDirective.cs index 4cf9866c..0703277f 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPSectionDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPSectionDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPSectionDirective : OMPExecutableDirective { - internal OMPSectionDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPSectionDirective) + internal OMPSectionDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPSectionDirective, CX_StmtClass.CX_StmtClass_OMPSectionDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPSectionsDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPSectionsDirective.cs index 5f86fee6..9b3d0dca 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPSectionsDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPSectionsDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPSectionsDirective : OMPExecutableDirective { - internal OMPSectionsDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPSectionsDirective) + internal OMPSectionsDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPSectionsDirective, CX_StmtClass.CX_StmtClass_OMPSectionsDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPSimdDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPSimdDirective.cs index 4505c4dd..76359ffc 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPSimdDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPSimdDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPSimdDirective : OMPLoopDirective { - internal OMPSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPSimdDirective) + internal OMPSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPSimdDirective, CX_StmtClass.CX_StmtClass_OMPSimdDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPSingleDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPSingleDirective.cs index f36bd7ed..0edc3ecf 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPSingleDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPSingleDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPSingleDirective : OMPExecutableDirective { - internal OMPSingleDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPSingleDirective) + internal OMPSingleDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPSingleDirective, CX_StmtClass.CX_StmtClass_OMPSingleDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetDataDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetDataDirective.cs index 5c8c254e..ffc3163a 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTargetDataDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetDataDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTargetDataDirective : OMPExecutableDirective { - internal OMPTargetDataDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetDataDirective) + internal OMPTargetDataDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetDataDirective, CX_StmtClass.CX_StmtClass_OMPTargetDataDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetDirective.cs index a02c1b83..db5513fc 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTargetDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTargetDirective : OMPExecutableDirective { - internal OMPTargetDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetDirective) + internal OMPTargetDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetDirective, CX_StmtClass.CX_StmtClass_OMPTargetDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetEnterDataDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetEnterDataDirective.cs index 23cc7fb9..954ec93b 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTargetEnterDataDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetEnterDataDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTargetEnterDataDirective : OMPExecutableDirective { - internal OMPTargetEnterDataDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetEnterDataDirective) + internal OMPTargetEnterDataDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetEnterDataDirective, CX_StmtClass.CX_StmtClass_OMPTargetEnterDataDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetExitDataDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetExitDataDirective.cs index 08e7261a..911be29e 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTargetExitDataDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetExitDataDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTargetExitDataDirective : OMPExecutableDirective { - internal OMPTargetExitDataDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetExitDataDirective) + internal OMPTargetExitDataDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetExitDataDirective, CX_StmtClass.CX_StmtClass_OMPTargetExitDataDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelDirective.cs index 82c0fab9..a77fb47c 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTargetParallelDirective : OMPExecutableDirective { - internal OMPTargetParallelDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetParallelDirective) + internal OMPTargetParallelDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetParallelDirective, CX_StmtClass.CX_StmtClass_OMPTargetParallelDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelForDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelForDirective.cs index 2e471da4..a76efc72 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelForDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelForDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTargetParallelForDirective : OMPLoopDirective { - internal OMPTargetParallelForDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetParallelForDirective) + internal OMPTargetParallelForDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetParallelForDirective, CX_StmtClass.CX_StmtClass_OMPTargetParallelForDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelForSimdDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelForSimdDirective.cs index 9566054c..567c8f6c 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelForSimdDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelForSimdDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTargetParallelForSimdDirective : OMPLoopDirective { - internal OMPTargetParallelForSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetParallelForSimdDirective) + internal OMPTargetParallelForSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetParallelForSimdDirective, CX_StmtClass.CX_StmtClass_OMPTargetParallelForSimdDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetSimdDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetSimdDirective.cs index 031ac7f2..a41d3880 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTargetSimdDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetSimdDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTargetSimdDirective : OMPLoopDirective { - internal OMPTargetSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetSimdDirective) + internal OMPTargetSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetSimdDirective, CX_StmtClass.CX_StmtClass_OMPTargetSimdDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDirective.cs index c616ba9c..7cd09ab3 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTargetTeamsDirective : OMPExecutableDirective { - internal OMPTargetTeamsDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetTeamsDirective) + internal OMPTargetTeamsDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetTeamsDirective, CX_StmtClass.CX_StmtClass_OMPTargetTeamsDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeDirective.cs index dba5baa3..2635043a 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTargetTeamsDistributeDirective : OMPLoopDirective { - internal OMPTargetTeamsDistributeDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetTeamsDistributeDirective) + internal OMPTargetTeamsDistributeDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetTeamsDistributeDirective, CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeParallelForDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeParallelForDirective.cs index 7f5c26ec..697539af 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeParallelForDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeParallelForDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTargetTeamsDistributeParallelForDirective : OMPLoopDirective { - internal OMPTargetTeamsDistributeParallelForDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetTeamsDistributeParallelForDirective) + internal OMPTargetTeamsDistributeParallelForDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetTeamsDistributeParallelForDirective, CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeParallelForDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeParallelForSimdDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeParallelForSimdDirective.cs index 1957c13d..f7273bd9 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeParallelForSimdDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeParallelForSimdDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTargetTeamsDistributeParallelForSimdDirective : OMPLoopDirective { - internal OMPTargetTeamsDistributeParallelForSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective) + internal OMPTargetTeamsDistributeParallelForSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective, CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeParallelForSimdDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeSimdDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeSimdDirective.cs index 1faa48a7..cc67b71f 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeSimdDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsDistributeSimdDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTargetTeamsDistributeSimdDirective : OMPLoopDirective { - internal OMPTargetTeamsDistributeSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetTeamsDistributeSimdDirective) + internal OMPTargetTeamsDistributeSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetTeamsDistributeSimdDirective, CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeSimdDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetUpdateDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetUpdateDirective.cs index 91409c99..8d8007c3 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTargetUpdateDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetUpdateDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTargetUpdateDirective : OMPExecutableDirective { - internal OMPTargetUpdateDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetUpdateDirective) + internal OMPTargetUpdateDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetUpdateDirective, CX_StmtClass.CX_StmtClass_OMPTargetUpdateDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTaskDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTaskDirective.cs index 054da20a..5e14a4b6 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTaskDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTaskDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTaskDirective : OMPExecutableDirective { - internal OMPTaskDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTaskDirective) + internal OMPTaskDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTaskDirective, CX_StmtClass.CX_StmtClass_OMPTaskDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTaskLoopDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTaskLoopDirective.cs index c19600a9..7f42152c 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTaskLoopDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTaskLoopDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTaskLoopDirective : OMPLoopDirective { - internal OMPTaskLoopDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTaskLoopDirective) + internal OMPTaskLoopDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTaskLoopDirective, CX_StmtClass.CX_StmtClass_OMPTaskLoopDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTaskLoopSimdDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTaskLoopSimdDirective.cs index f77fb401..f8df1d43 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTaskLoopSimdDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTaskLoopSimdDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTaskLoopSimdDirective : OMPLoopDirective { - internal OMPTaskLoopSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTaskLoopSimdDirective) + internal OMPTaskLoopSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTaskLoopSimdDirective, CX_StmtClass.CX_StmtClass_OMPTaskLoopSimdDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTaskgroupDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTaskgroupDirective.cs index 66d93566..7a22206f 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTaskgroupDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTaskgroupDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTaskgroupDirective : OMPExecutableDirective { - internal OMPTaskgroupDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTaskgroupDirective) + internal OMPTaskgroupDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTaskgroupDirective, CX_StmtClass.CX_StmtClass_OMPTaskgroupDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTaskwaitDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTaskwaitDirective.cs index 68ac1f0c..09b21b4f 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTaskwaitDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTaskwaitDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTaskwaitDirective : OMPExecutableDirective { - internal OMPTaskwaitDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTaskwaitDirective) + internal OMPTaskwaitDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTaskwaitDirective, CX_StmtClass.CX_StmtClass_OMPTaskwaitDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTaskyieldDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTaskyieldDirective.cs index 0b5242b8..343ef61c 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTaskyieldDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTaskyieldDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTaskyieldDirective : OMPExecutableDirective { - internal OMPTaskyieldDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTaskyieldDirective) + internal OMPTaskyieldDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTaskyieldDirective, CX_StmtClass.CX_StmtClass_OMPTaskyieldDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTeamsDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTeamsDirective.cs index 29e42e72..aed4d68d 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTeamsDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTeamsDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTeamsDirective : OMPExecutableDirective { - internal OMPTeamsDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTeamsDirective) + internal OMPTeamsDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTeamsDirective, CX_StmtClass.CX_StmtClass_OMPTeamsDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeDirective.cs index 943a1e32..6a89a87d 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTeamsDistributeDirective : OMPLoopDirective { - internal OMPTeamsDistributeDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTeamsDistributeDirective) + internal OMPTeamsDistributeDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTeamsDistributeDirective, CX_StmtClass.CX_StmtClass_OMPTeamsDistributeDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeParallelForDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeParallelForDirective.cs index e22bd5ad..110f0b86 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeParallelForDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeParallelForDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTeamsDistributeParallelForDirective : OMPLoopDirective { - internal OMPTeamsDistributeParallelForDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTeamsDistributeParallelForDirective) + internal OMPTeamsDistributeParallelForDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTeamsDistributeParallelForDirective, CX_StmtClass.CX_StmtClass_OMPTeamsDistributeParallelForDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeParallelForSimdDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeParallelForSimdDirective.cs index 9da916fb..8c1f911e 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeParallelForSimdDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeParallelForSimdDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTeamsDistributeParallelForSimdDirective : OMPLoopDirective { - internal OMPTeamsDistributeParallelForSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTeamsDistributeParallelForSimdDirective) + internal OMPTeamsDistributeParallelForSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTeamsDistributeParallelForSimdDirective, CX_StmtClass.CX_StmtClass_OMPTeamsDistributeParallelForSimdDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeSimdDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeSimdDirective.cs index f306546b..7b8d4cd4 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeSimdDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPTeamsDistributeSimdDirective.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class OMPTeamsDistributeSimdDirective : OMPLoopDirective { - internal OMPTeamsDistributeSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTeamsDistributeSimdDirective) + internal OMPTeamsDistributeSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTeamsDistributeSimdDirective, CX_StmtClass.CX_StmtClass_OMPTeamsDistributeSimdDirective) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/ObjCAtCatchStmt.cs b/sources/ClangSharp/Cursors/Stmts/ObjCAtCatchStmt.cs index 072cc257..3d6733dc 100644 --- a/sources/ClangSharp/Cursors/Stmts/ObjCAtCatchStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ObjCAtCatchStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCAtCatchStmt : Stmt { - internal ObjCAtCatchStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAtCatchStmt) + internal ObjCAtCatchStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAtCatchStmt, CX_StmtClass.CX_StmtClass_ObjCAtCatchStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/ObjCAtFinallyStmt.cs b/sources/ClangSharp/Cursors/Stmts/ObjCAtFinallyStmt.cs index 04d96242..d2b70ae1 100644 --- a/sources/ClangSharp/Cursors/Stmts/ObjCAtFinallyStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ObjCAtFinallyStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCAtFinallyStmt : Stmt { - internal ObjCAtFinallyStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAtFinallyStmt) + internal ObjCAtFinallyStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAtFinallyStmt, CX_StmtClass.CX_StmtClass_ObjCAtFinallyStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/ObjCAtSynchronizedStmt.cs b/sources/ClangSharp/Cursors/Stmts/ObjCAtSynchronizedStmt.cs index 8238bec6..9cfe653f 100644 --- a/sources/ClangSharp/Cursors/Stmts/ObjCAtSynchronizedStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ObjCAtSynchronizedStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCAtSynchronizedStmt : Stmt { - internal ObjCAtSynchronizedStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAtSynchronizedStmt) + internal ObjCAtSynchronizedStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAtSynchronizedStmt, CX_StmtClass.CX_StmtClass_ObjCAtSynchronizedStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/ObjCAtThrowStmt.cs b/sources/ClangSharp/Cursors/Stmts/ObjCAtThrowStmt.cs index 78d8de5c..f6174013 100644 --- a/sources/ClangSharp/Cursors/Stmts/ObjCAtThrowStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ObjCAtThrowStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCAtThrowStmt : Stmt { - internal ObjCAtThrowStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAtThrowStmt) + internal ObjCAtThrowStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAtThrowStmt, CX_StmtClass.CX_StmtClass_ObjCAtThrowStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/ObjCAtTryStmt.cs b/sources/ClangSharp/Cursors/Stmts/ObjCAtTryStmt.cs index e4f3747b..f2651b0e 100644 --- a/sources/ClangSharp/Cursors/Stmts/ObjCAtTryStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ObjCAtTryStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCAtTryStmt : Stmt { - internal ObjCAtTryStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAtTryStmt) + internal ObjCAtTryStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAtTryStmt, CX_StmtClass.CX_StmtClass_ObjCAtTryStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/ObjCAutoreleasePoolStmt.cs b/sources/ClangSharp/Cursors/Stmts/ObjCAutoreleasePoolStmt.cs index e84d8a2f..3bc02e34 100644 --- a/sources/ClangSharp/Cursors/Stmts/ObjCAutoreleasePoolStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ObjCAutoreleasePoolStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCAutoreleasePoolStmt : Stmt { - internal ObjCAutoreleasePoolStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAutoreleasePoolStmt) + internal ObjCAutoreleasePoolStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAutoreleasePoolStmt, CX_StmtClass.CX_StmtClass_ObjCAutoreleasePoolStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/ObjCForCollectionStmt.cs b/sources/ClangSharp/Cursors/Stmts/ObjCForCollectionStmt.cs index 113a87bb..4a57ac40 100644 --- a/sources/ClangSharp/Cursors/Stmts/ObjCForCollectionStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ObjCForCollectionStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ObjCForCollectionStmt : Stmt { - internal ObjCForCollectionStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCForCollectionStmt) + internal ObjCForCollectionStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCForCollectionStmt, CX_StmtClass.CX_StmtClass_ObjCForCollectionStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/ReturnStmt.cs b/sources/ClangSharp/Cursors/Stmts/ReturnStmt.cs index ee61a784..7ec91e8d 100644 --- a/sources/ClangSharp/Cursors/Stmts/ReturnStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ReturnStmt.cs @@ -10,7 +10,7 @@ public sealed class ReturnStmt : Stmt { private readonly Lazy _retValue; - internal ReturnStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ReturnStmt) + internal ReturnStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ReturnStmt, CX_StmtClass.CX_StmtClass_ReturnStmt) { _retValue = new Lazy(() => Children.OfType().Single()); } diff --git a/sources/ClangSharp/Cursors/Stmts/SEHExceptStmt.cs b/sources/ClangSharp/Cursors/Stmts/SEHExceptStmt.cs index 70a2798c..23ac58bd 100644 --- a/sources/ClangSharp/Cursors/Stmts/SEHExceptStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/SEHExceptStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class SEHExceptStmt : Stmt { - internal SEHExceptStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_SEHExceptStmt) + internal SEHExceptStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_SEHExceptStmt, CX_StmtClass.CX_StmtClass_SEHExceptStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/SEHFinallyStmt.cs b/sources/ClangSharp/Cursors/Stmts/SEHFinallyStmt.cs index 1b1b74cc..277ebb49 100644 --- a/sources/ClangSharp/Cursors/Stmts/SEHFinallyStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/SEHFinallyStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class SEHFinallyStmt : Stmt { - internal SEHFinallyStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_SEHFinallyStmt) + internal SEHFinallyStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_SEHFinallyStmt, CX_StmtClass.CX_StmtClass_SEHFinallyStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/SEHLeaveStmt.cs b/sources/ClangSharp/Cursors/Stmts/SEHLeaveStmt.cs index d797c5fc..f95318ad 100644 --- a/sources/ClangSharp/Cursors/Stmts/SEHLeaveStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/SEHLeaveStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class SEHLeaveStmt : Stmt { - internal SEHLeaveStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_SEHLeaveStmt) + internal SEHLeaveStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_SEHLeaveStmt, CX_StmtClass.CX_StmtClass_SEHLeaveStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/SEHTryStmt.cs b/sources/ClangSharp/Cursors/Stmts/SEHTryStmt.cs index fd6e0b86..5fc9d1c9 100644 --- a/sources/ClangSharp/Cursors/Stmts/SEHTryStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/SEHTryStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class SEHTryStmt : Stmt { - internal SEHTryStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_SEHTryStmt) + internal SEHTryStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_SEHTryStmt, CX_StmtClass.CX_StmtClass_SEHTryStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/Stmt.cs b/sources/ClangSharp/Cursors/Stmts/Stmt.cs index f8417c2e..2aae49e6 100644 --- a/sources/ClangSharp/Cursors/Stmts/Stmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/Stmt.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using ClangSharp.Interop; @@ -12,516 +11,221 @@ public class Stmt : Cursor { private readonly Lazy> _children; - private protected Stmt(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected Stmt(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind) { + if ((handle.StmtClass == CX_StmtClass.CX_StmtClass_Invalid) || (handle.StmtClass != expectedStmtClass)) + { + throw new ArgumentException(nameof(handle)); + } + _children = new Lazy>(() => CursorChildren.OfType().ToList()); } public IReadOnlyList Children => _children.Value; - public CX_StmtKind StmtClass => Handle.StmtKind; + public CX_StmtClass StmtClass => Handle.StmtClass; - internal static new Stmt Create(CXCursor handle) + internal static new Stmt Create(CXCursor handle) => handle.StmtClass switch { - Stmt result; - - switch (handle.Kind) - { - case CXCursorKind.CXCursor_UnexposedStmt: - { - result = new Stmt(handle, handle.Kind); - break; - } - - case CXCursorKind.CXCursor_LabelStmt: - { - result = new LabelStmt(handle); - break; - } - - case CXCursorKind.CXCursor_CompoundStmt: - { - result = new CompoundStmt(handle); - break; - } - - case CXCursorKind.CXCursor_CaseStmt: - { - result = new CaseStmt(handle); - break; - } - - case CXCursorKind.CXCursor_DefaultStmt: - { - result = new DefaultStmt(handle); - break; - } - - case CXCursorKind.CXCursor_IfStmt: - { - result = new IfStmt(handle); - break; - } - - case CXCursorKind.CXCursor_SwitchStmt: - { - result = new SwitchStmt(handle); - break; - } - - case CXCursorKind.CXCursor_WhileStmt: - { - result = new WhileStmt(handle); - break; - } - - case CXCursorKind.CXCursor_DoStmt: - { - result = new DoStmt(handle); - break; - } - - case CXCursorKind.CXCursor_ForStmt: - { - result = new ForStmt(handle); - break; - } - - case CXCursorKind.CXCursor_GotoStmt: - { - result = new GotoStmt(handle); - break; - } - - case CXCursorKind.CXCursor_IndirectGotoStmt: - { - result = new IndirectGotoStmt(handle); - break; - } - - case CXCursorKind.CXCursor_ContinueStmt: - { - result = new ContinueStmt(handle); - break; - } - - case CXCursorKind.CXCursor_BreakStmt: - { - result = new BreakStmt(handle); - break; - } - - case CXCursorKind.CXCursor_ReturnStmt: - { - result = new ReturnStmt(handle); - break; - } - - case CXCursorKind.CXCursor_GCCAsmStmt: - { - result = new GCCAsmStmt(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCAtTryStmt: - { - result = new ObjCAtTryStmt(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCAtCatchStmt: - { - result = new ObjCAtCatchStmt(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCAtFinallyStmt: - { - result = new ObjCAtFinallyStmt(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCAtThrowStmt: - { - result = new ObjCAtThrowStmt(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCAtSynchronizedStmt: - { - result = new ObjCAtSynchronizedStmt(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCAutoreleasePoolStmt: - { - result = new ObjCAutoreleasePoolStmt(handle); - break; - } - - case CXCursorKind.CXCursor_ObjCForCollectionStmt: - { - result = new ObjCForCollectionStmt(handle); - break; - } - - case CXCursorKind.CXCursor_CXXCatchStmt: - { - result = new CXXCatchStmt(handle); - break; - } - - case CXCursorKind.CXCursor_CXXTryStmt: - { - result = new CXXTryStmt(handle); - break; - } - - case CXCursorKind.CXCursor_CXXForRangeStmt: - { - result = new CXXForRangeStmt(handle); - break; - } - - case CXCursorKind.CXCursor_SEHTryStmt: - { - result = new SEHTryStmt(handle); - break; - } - - case CXCursorKind.CXCursor_SEHExceptStmt: - { - result = new SEHExceptStmt(handle); - break; - } - - case CXCursorKind.CXCursor_SEHFinallyStmt: - { - result = new SEHFinallyStmt(handle); - break; - } - - case CXCursorKind.CXCursor_MSAsmStmt: - { - result = new MSAsmStmt(handle); - break; - } - - case CXCursorKind.CXCursor_NullStmt: - { - result = new NullStmt(handle); - break; - } - - case CXCursorKind.CXCursor_DeclStmt: - { - result = new DeclStmt(handle); - break; - } - - case CXCursorKind.CXCursor_OMPParallelDirective: - { - result = new OMPParallelDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPSimdDirective: - { - result = new OMPSimdDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPForDirective: - { - result = new OMPForDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPSectionsDirective: - { - result = new OMPSectionsDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPSectionDirective: - { - result = new OMPSectionDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPSingleDirective: - { - result = new OMPSingleDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPParallelForDirective: - { - result = new OMPParallelForDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPParallelSectionsDirective: - { - result = new OMPParallelSectionsDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTaskDirective: - { - result = new OMPTaskDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPMasterDirective: - { - result = new OMPMasterDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPCriticalDirective: - { - result = new OMPCriticalDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTaskyieldDirective: - { - result = new OMPTaskyieldDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPBarrierDirective: - { - result = new OMPBarrierDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTaskwaitDirective: - { - result = new OMPTaskwaitDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPFlushDirective: - { - result = new OMPFlushDirective(handle); - break; - } - - case CXCursorKind.CXCursor_SEHLeaveStmt: - { - result = new SEHLeaveStmt(handle); - break; - } - - case CXCursorKind.CXCursor_OMPOrderedDirective: - { - result = new OMPOrderedDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPAtomicDirective: - { - result = new OMPAtomicDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPForSimdDirective: - { - result = new OMPForSimdDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPParallelForSimdDirective: - { - result = new OMPParallelForSimdDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTargetDirective: - { - result = new OMPTargetDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTeamsDirective: - { - result = new OMPTeamsDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTaskgroupDirective: - { - result = new OMPTaskgroupDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPCancellationPointDirective: - { - result = new OMPCancellationPointDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPCancelDirective: - { - result = new OMPCancelDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTargetDataDirective: - { - result = new OMPTargetDataDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTaskLoopDirective: - { - result = new OMPTaskLoopDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTaskLoopSimdDirective: - { - result = new OMPTaskLoopSimdDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPDistributeDirective: - { - result = new OMPDistributeDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTargetEnterDataDirective: - { - result = new OMPTargetEnterDataDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTargetExitDataDirective: - { - result = new OMPTargetExitDataDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTargetParallelDirective: - { - result = new OMPTargetParallelDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTargetParallelForDirective: - { - result = new OMPTargetParallelForDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTargetUpdateDirective: - { - result = new OMPTargetUpdateDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPDistributeParallelForDirective: - { - result = new OMPDistributeParallelForDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPDistributeParallelForSimdDirective: - { - result = new OMPDistributeParallelForSimdDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPDistributeSimdDirective: - { - result = new OMPDistributeSimdDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTargetParallelForSimdDirective: - { - result = new OMPTargetParallelForSimdDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTargetSimdDirective: - { - result = new OMPTargetSimdDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTeamsDistributeDirective: - { - result = new OMPTeamsDistributeDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTeamsDistributeSimdDirective: - { - result = new OMPTeamsDistributeSimdDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTeamsDistributeParallelForSimdDirective: - { - result = new OMPTeamsDistributeParallelForSimdDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTeamsDistributeParallelForDirective: - { - result = new OMPTeamsDistributeParallelForDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTargetTeamsDirective: - { - result = new OMPTargetTeamsDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTargetTeamsDistributeDirective: - { - result = new OMPTargetTeamsDistributeDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTargetTeamsDistributeParallelForDirective: - { - result = new OMPTargetTeamsDistributeParallelForDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective: - { - result = new OMPTargetTeamsDistributeParallelForSimdDirective(handle); - break; - } - - case CXCursorKind.CXCursor_OMPTargetTeamsDistributeSimdDirective: - { - result = new OMPTargetTeamsDistributeSimdDirective(handle); - break; - } - - case CXCursorKind.CXCursor_BuiltinBitCastExpr: - { - result = new BuiltinBitCastExpr(handle); - break; - } - - default: - { - Debug.WriteLine($"Unhandled statement kind: {handle.KindSpelling}."); - result = new Stmt(handle, handle.Kind); - break; - } - } - - return result; - } + CX_StmtClass.CX_StmtClass_GCCAsmStmt => new GCCAsmStmt(handle), + CX_StmtClass.CX_StmtClass_MSAsmStmt => new MSAsmStmt(handle), + CX_StmtClass.CX_StmtClass_BreakStmt => new BreakStmt(handle), + CX_StmtClass.CX_StmtClass_CXXCatchStmt => new CXXCatchStmt(handle), + CX_StmtClass.CX_StmtClass_CXXForRangeStmt => new CXXForRangeStmt(handle), + CX_StmtClass.CX_StmtClass_CXXTryStmt => new CXXTryStmt(handle), + CX_StmtClass.CX_StmtClass_CapturedStmt => new CapturedStmt(handle), + CX_StmtClass.CX_StmtClass_CompoundStmt => new CompoundStmt(handle), + CX_StmtClass.CX_StmtClass_ContinueStmt => new ContinueStmt(handle), + CX_StmtClass.CX_StmtClass_CoreturnStmt => new CoreturnStmt(handle), + CX_StmtClass.CX_StmtClass_CoroutineBodyStmt => new CoroutineBodyStmt(handle), + CX_StmtClass.CX_StmtClass_DeclStmt => new DeclStmt(handle), + CX_StmtClass.CX_StmtClass_DoStmt => new DoStmt(handle), + CX_StmtClass.CX_StmtClass_ForStmt => new ForStmt(handle), + CX_StmtClass.CX_StmtClass_GotoStmt => new GotoStmt(handle), + CX_StmtClass.CX_StmtClass_IfStmt => new IfStmt(handle), + CX_StmtClass.CX_StmtClass_IndirectGotoStmt => new IndirectGotoStmt(handle), + CX_StmtClass.CX_StmtClass_MSDependentExistsStmt => new MSDependentExistsStmt(handle), + CX_StmtClass.CX_StmtClass_NullStmt => new NullStmt(handle), + CX_StmtClass.CX_StmtClass_OMPAtomicDirective => new OMPAtomicDirective(handle), + CX_StmtClass.CX_StmtClass_OMPBarrierDirective => new OMPBarrierDirective(handle), + CX_StmtClass.CX_StmtClass_OMPCancelDirective => new OMPCancelDirective(handle), + CX_StmtClass.CX_StmtClass_OMPCancellationPointDirective => new OMPCancellationPointDirective(handle), + CX_StmtClass.CX_StmtClass_OMPCriticalDirective => new OMPCriticalDirective(handle), + CX_StmtClass.CX_StmtClass_OMPFlushDirective => new OMPFlushDirective(handle), + CX_StmtClass.CX_StmtClass_OMPDistributeDirective => new OMPDistributeDirective(handle), + CX_StmtClass.CX_StmtClass_OMPDistributeParallelForDirective => new OMPDistributeParallelForDirective(handle), + CX_StmtClass.CX_StmtClass_OMPDistributeParallelForSimdDirective => new OMPDistributeParallelForSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPDistributeSimdDirective => new OMPDistributeSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPForDirective => new OMPForDirective(handle), + CX_StmtClass.CX_StmtClass_OMPForSimdDirective => new OMPForSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPParallelForDirective => new OMPParallelForDirective(handle), + CX_StmtClass.CX_StmtClass_OMPParallelForSimdDirective => new OMPParallelForSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPSimdDirective => new OMPSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetParallelForSimdDirective => new OMPTargetParallelForSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetSimdDirective => new OMPTargetSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeDirective => new OMPTargetTeamsDistributeDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeParallelForDirective => new OMPTargetTeamsDistributeParallelForDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeParallelForSimdDirective => new OMPTargetTeamsDistributeParallelForSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeSimdDirective => new OMPTargetTeamsDistributeSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTaskLoopDirective => new OMPTaskLoopDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTaskLoopSimdDirective => new OMPTaskLoopSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTeamsDistributeDirective => new OMPTeamsDistributeDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTeamsDistributeParallelForDirective => new OMPTeamsDistributeParallelForDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTeamsDistributeParallelForSimdDirective => new OMPTeamsDistributeParallelForSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTeamsDistributeSimdDirective => new OMPTeamsDistributeSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPMasterDirective => new OMPMasterDirective(handle), + CX_StmtClass.CX_StmtClass_OMPOrderedDirective => new OMPOrderedDirective(handle), + CX_StmtClass.CX_StmtClass_OMPParallelDirective => new OMPParallelDirective(handle), + CX_StmtClass.CX_StmtClass_OMPParallelSectionsDirective => new OMPParallelSectionsDirective(handle), + CX_StmtClass.CX_StmtClass_OMPSectionDirective => new OMPSectionDirective(handle), + CX_StmtClass.CX_StmtClass_OMPSectionsDirective => new OMPSectionsDirective(handle), + CX_StmtClass.CX_StmtClass_OMPSingleDirective => new OMPSingleDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetDataDirective => new OMPTargetDataDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetDirective => new OMPTargetDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetEnterDataDirective => new OMPTargetEnterDataDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetExitDataDirective => new OMPTargetExitDataDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetParallelDirective => new OMPTargetParallelDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetParallelForDirective => new OMPTargetParallelForDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetTeamsDirective => new OMPTargetTeamsDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetUpdateDirective => new OMPTargetUpdateDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTaskDirective => new OMPTaskDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTaskgroupDirective => new OMPTaskgroupDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTaskwaitDirective => new OMPTaskwaitDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTaskyieldDirective => new OMPTaskyieldDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTeamsDirective => new OMPTeamsDirective(handle), + CX_StmtClass.CX_StmtClass_ObjCAtCatchStmt => new ObjCAtCatchStmt(handle), + CX_StmtClass.CX_StmtClass_ObjCAtFinallyStmt => new ObjCAtFinallyStmt(handle), + CX_StmtClass.CX_StmtClass_ObjCAtSynchronizedStmt => new ObjCAtSynchronizedStmt(handle), + CX_StmtClass.CX_StmtClass_ObjCAtThrowStmt => new ObjCAtThrowStmt(handle), + CX_StmtClass.CX_StmtClass_ObjCAtTryStmt => new ObjCAtTryStmt(handle), + CX_StmtClass.CX_StmtClass_ObjCAutoreleasePoolStmt => new ObjCAutoreleasePoolStmt(handle), + CX_StmtClass.CX_StmtClass_ObjCForCollectionStmt => new ObjCForCollectionStmt(handle), + CX_StmtClass.CX_StmtClass_ReturnStmt => new ReturnStmt(handle), + CX_StmtClass.CX_StmtClass_SEHExceptStmt => new SEHExceptStmt(handle), + CX_StmtClass.CX_StmtClass_SEHFinallyStmt => new SEHFinallyStmt(handle), + CX_StmtClass.CX_StmtClass_SEHLeaveStmt => new SEHLeaveStmt(handle), + CX_StmtClass.CX_StmtClass_SEHTryStmt => new SEHTryStmt(handle), + CX_StmtClass.CX_StmtClass_CaseStmt => new CaseStmt(handle), + CX_StmtClass.CX_StmtClass_DefaultStmt => new DefaultStmt(handle), + CX_StmtClass.CX_StmtClass_SwitchStmt => new SwitchStmt(handle), + CX_StmtClass.CX_StmtClass_AttributedStmt => new AttributedStmt(handle), + CX_StmtClass.CX_StmtClass_BinaryConditionalOperator => new BinaryConditionalOperator(handle), + CX_StmtClass.CX_StmtClass_ConditionalOperator => new ConditionalOperator(handle), + CX_StmtClass.CX_StmtClass_AddrLabelExpr => new AddrLabelExpr(handle), + CX_StmtClass.CX_StmtClass_ArrayInitIndexExpr => new ArrayInitIndexExpr(handle), + CX_StmtClass.CX_StmtClass_ArrayInitLoopExpr => new ArrayInitLoopExpr(handle), + CX_StmtClass.CX_StmtClass_ArraySubscriptExpr => new ArraySubscriptExpr(handle), + CX_StmtClass.CX_StmtClass_ArrayTypeTraitExpr => new ArrayTypeTraitExpr(handle), + CX_StmtClass.CX_StmtClass_AsTypeExpr => new AsTypeExpr(handle), + CX_StmtClass.CX_StmtClass_AtomicExpr => new AtomicExpr(handle), + CX_StmtClass.CX_StmtClass_BinaryOperator => new BinaryOperator(handle), + CX_StmtClass.CX_StmtClass_CompoundAssignOperator => new CompoundAssignOperator(handle), + CX_StmtClass.CX_StmtClass_BlockExpr => new BlockExpr(handle), + CX_StmtClass.CX_StmtClass_CXXBindTemporaryExpr => new CXXBindTemporaryExpr(handle), + CX_StmtClass.CX_StmtClass_CXXBoolLiteralExpr => new CXXBoolLiteralExpr(handle), + CX_StmtClass.CX_StmtClass_CXXConstructExpr => new CXXConstructExpr(handle), + CX_StmtClass.CX_StmtClass_CXXTemporaryObjectExpr => new CXXTemporaryObjectExpr(handle), + CX_StmtClass.CX_StmtClass_CXXDefaultArgExpr => new CXXDefaultArgExpr(handle), + CX_StmtClass.CX_StmtClass_CXXDefaultInitExpr => new CXXDefaultInitExpr(handle), + CX_StmtClass.CX_StmtClass_CXXDeleteExpr => new CXXDeleteExpr(handle), + CX_StmtClass.CX_StmtClass_CXXDependentScopeMemberExpr => new CXXDependentScopeMemberExpr(handle), + CX_StmtClass.CX_StmtClass_CXXFoldExpr => new CXXFoldExpr(handle), + CX_StmtClass.CX_StmtClass_CXXInheritedCtorInitExpr => new CXXInheritedCtorInitExpr(handle), + CX_StmtClass.CX_StmtClass_CXXNewExpr => new CXXNewExpr(handle), + CX_StmtClass.CX_StmtClass_CXXNoexceptExpr => new CXXNoexceptExpr(handle), + CX_StmtClass.CX_StmtClass_CXXNullPtrLiteralExpr => new CXXNullPtrLiteralExpr(handle), + CX_StmtClass.CX_StmtClass_CXXPseudoDestructorExpr => new CXXPseudoDestructorExpr(handle), + CX_StmtClass.CX_StmtClass_CXXScalarValueInitExpr => new CXXScalarValueInitExpr(handle), + CX_StmtClass.CX_StmtClass_CXXStdInitializerListExpr => new CXXStdInitializerListExpr(handle), + CX_StmtClass.CX_StmtClass_CXXThisExpr => new CXXThisExpr(handle), + CX_StmtClass.CX_StmtClass_CXXThrowExpr => new CXXThrowExpr(handle), + CX_StmtClass.CX_StmtClass_CXXTypeidExpr => new CXXTypeidExpr(handle), + CX_StmtClass.CX_StmtClass_CXXUnresolvedConstructExpr => new CXXUnresolvedConstructExpr(handle), + CX_StmtClass.CX_StmtClass_CXXUuidofExpr => new CXXUuidofExpr(handle), + CX_StmtClass.CX_StmtClass_CallExpr => new CallExpr(handle), + CX_StmtClass.CX_StmtClass_CUDAKernelCallExpr => new CUDAKernelCallExpr(handle), + CX_StmtClass.CX_StmtClass_CXXMemberCallExpr => new CXXMemberCallExpr(handle), + CX_StmtClass.CX_StmtClass_CXXOperatorCallExpr => new CXXOperatorCallExpr(handle), + CX_StmtClass.CX_StmtClass_UserDefinedLiteral => new UserDefinedLiteral(handle), + CX_StmtClass.CX_StmtClass_BuiltinBitCastExpr => new BuiltinBitCastExpr(handle), + CX_StmtClass.CX_StmtClass_CStyleCastExpr => new CStyleCastExpr(handle), + CX_StmtClass.CX_StmtClass_CXXFunctionalCastExpr => new CXXFunctionalCastExpr(handle), + CX_StmtClass.CX_StmtClass_CXXConstCastExpr => new CXXConstCastExpr(handle), + CX_StmtClass.CX_StmtClass_CXXDynamicCastExpr => new CXXDynamicCastExpr(handle), + CX_StmtClass.CX_StmtClass_CXXReinterpretCastExpr => new CXXReinterpretCastExpr(handle), + CX_StmtClass.CX_StmtClass_CXXStaticCastExpr => new CXXStaticCastExpr(handle), + CX_StmtClass.CX_StmtClass_ObjCBridgedCastExpr => new ObjCBridgedCastExpr(handle), + CX_StmtClass.CX_StmtClass_ImplicitCastExpr => new ImplicitCastExpr(handle), + CX_StmtClass.CX_StmtClass_CharacterLiteral => new CharacterLiteral(handle), + CX_StmtClass.CX_StmtClass_ChooseExpr => new ChooseExpr(handle), + CX_StmtClass.CX_StmtClass_CompoundLiteralExpr => new CompoundLiteralExpr(handle), + CX_StmtClass.CX_StmtClass_ConvertVectorExpr => new ConvertVectorExpr(handle), + CX_StmtClass.CX_StmtClass_CoawaitExpr => new CoawaitExpr(handle), + CX_StmtClass.CX_StmtClass_CoyieldExpr => new CoyieldExpr(handle), + CX_StmtClass.CX_StmtClass_DeclRefExpr => new DeclRefExpr(handle), + CX_StmtClass.CX_StmtClass_DependentCoawaitExpr => new DependentCoawaitExpr(handle), + CX_StmtClass.CX_StmtClass_DependentScopeDeclRefExpr => new DependentScopeDeclRefExpr(handle), + CX_StmtClass.CX_StmtClass_DesignatedInitExpr => new DesignatedInitExpr(handle), + CX_StmtClass.CX_StmtClass_DesignatedInitUpdateExpr => new DesignatedInitUpdateExpr(handle), + CX_StmtClass.CX_StmtClass_ExpressionTraitExpr => new ExpressionTraitExpr(handle), + CX_StmtClass.CX_StmtClass_ExtVectorElementExpr => new ExtVectorElementExpr(handle), + CX_StmtClass.CX_StmtClass_FixedPointLiteral => new FixedPointLiteral(handle), + CX_StmtClass.CX_StmtClass_FloatingLiteral => new FloatingLiteral(handle), + CX_StmtClass.CX_StmtClass_ConstantExpr => new ConstantExpr(handle), + CX_StmtClass.CX_StmtClass_ExprWithCleanups => new ExprWithCleanups(handle), + CX_StmtClass.CX_StmtClass_FunctionParmPackExpr => new FunctionParmPackExpr(handle), + CX_StmtClass.CX_StmtClass_GNUNullExpr => new GNUNullExpr(handle), + CX_StmtClass.CX_StmtClass_GenericSelectionExpr => new GenericSelectionExpr(handle), + CX_StmtClass.CX_StmtClass_ImaginaryLiteral => new ImaginaryLiteral(handle), + CX_StmtClass.CX_StmtClass_ImplicitValueInitExpr => new ImplicitValueInitExpr(handle), + CX_StmtClass.CX_StmtClass_InitListExpr => new InitListExpr(handle), + CX_StmtClass.CX_StmtClass_IntegerLiteral => new IntegerLiteral(handle), + CX_StmtClass.CX_StmtClass_LambdaExpr => new LambdaExpr(handle), + CX_StmtClass.CX_StmtClass_MSPropertyRefExpr => new MSPropertyRefExpr(handle), + CX_StmtClass.CX_StmtClass_MSPropertySubscriptExpr => new MSPropertySubscriptExpr(handle), + CX_StmtClass.CX_StmtClass_MaterializeTemporaryExpr => new MaterializeTemporaryExpr(handle), + CX_StmtClass.CX_StmtClass_MemberExpr => new MemberExpr(handle), + CX_StmtClass.CX_StmtClass_NoInitExpr => new NoInitExpr(handle), + CX_StmtClass.CX_StmtClass_OMPArraySectionExpr => new OMPArraySectionExpr(handle), + CX_StmtClass.CX_StmtClass_ObjCArrayLiteral => new ObjCArrayLiteral(handle), + CX_StmtClass.CX_StmtClass_ObjCAvailabilityCheckExpr => new ObjCAvailabilityCheckExpr(handle), + CX_StmtClass.CX_StmtClass_ObjCBoolLiteralExpr => new ObjCBoolLiteralExpr(handle), + CX_StmtClass.CX_StmtClass_ObjCBoxedExpr => new ObjCBoxedExpr(handle), + CX_StmtClass.CX_StmtClass_ObjCDictionaryLiteral => new ObjCDictionaryLiteral(handle), + CX_StmtClass.CX_StmtClass_ObjCEncodeExpr => new ObjCEncodeExpr(handle), + CX_StmtClass.CX_StmtClass_ObjCIndirectCopyRestoreExpr => new ObjCIndirectCopyRestoreExpr(handle), + CX_StmtClass.CX_StmtClass_ObjCIsaExpr => new ObjCIsaExpr(handle), + CX_StmtClass.CX_StmtClass_ObjCIvarRefExpr => new ObjCIvarRefExpr(handle), + CX_StmtClass.CX_StmtClass_ObjCMessageExpr => new ObjCMessageExpr(handle), + CX_StmtClass.CX_StmtClass_ObjCPropertyRefExpr => new ObjCPropertyRefExpr(handle), + CX_StmtClass.CX_StmtClass_ObjCProtocolExpr => new ObjCProtocolExpr(handle), + CX_StmtClass.CX_StmtClass_ObjCSelectorExpr => new ObjCSelectorExpr(handle), + CX_StmtClass.CX_StmtClass_ObjCStringLiteral => new ObjCStringLiteral(handle), + CX_StmtClass.CX_StmtClass_ObjCSubscriptRefExpr => new ObjCSubscriptRefExpr(handle), + CX_StmtClass.CX_StmtClass_OffsetOfExpr => new OffsetOfExpr(handle), + CX_StmtClass.CX_StmtClass_OpaqueValueExpr => new OpaqueValueExpr(handle), + CX_StmtClass.CX_StmtClass_UnresolvedLookupExpr => new UnresolvedLookupExpr(handle), + CX_StmtClass.CX_StmtClass_UnresolvedMemberExpr => new UnresolvedMemberExpr(handle), + CX_StmtClass.CX_StmtClass_PackExpansionExpr => new PackExpansionExpr(handle), + CX_StmtClass.CX_StmtClass_ParenExpr => new ParenExpr(handle), + CX_StmtClass.CX_StmtClass_ParenListExpr => new ParenListExpr(handle), + CX_StmtClass.CX_StmtClass_PredefinedExpr => new PredefinedExpr(handle), + CX_StmtClass.CX_StmtClass_PseudoObjectExpr => new PseudoObjectExpr(handle), + CX_StmtClass.CX_StmtClass_ShuffleVectorExpr => new ShuffleVectorExpr(handle), + CX_StmtClass.CX_StmtClass_SizeOfPackExpr => new SizeOfPackExpr(handle), + CX_StmtClass.CX_StmtClass_SourceLocExpr => new SourceLocExpr(handle), + CX_StmtClass.CX_StmtClass_StmtExpr => new StmtExpr(handle), + CX_StmtClass.CX_StmtClass_StringLiteral => new StringLiteral(handle), + CX_StmtClass.CX_StmtClass_SubstNonTypeTemplateParmExpr => new SubstNonTypeTemplateParmExpr(handle), + CX_StmtClass.CX_StmtClass_SubstNonTypeTemplateParmPackExpr => new SubstNonTypeTemplateParmPackExpr(handle), + CX_StmtClass.CX_StmtClass_TypeTraitExpr => new TypeTraitExpr(handle), + CX_StmtClass.CX_StmtClass_TypoExpr => new TypoExpr(handle), + CX_StmtClass.CX_StmtClass_UnaryExprOrTypeTraitExpr => new UnaryExprOrTypeTraitExpr(handle), + CX_StmtClass.CX_StmtClass_UnaryOperator => new UnaryOperator(handle), + CX_StmtClass.CX_StmtClass_VAArgExpr => new VAArgExpr(handle), + CX_StmtClass.CX_StmtClass_LabelStmt => new LabelStmt(handle), + CX_StmtClass.CX_StmtClass_WhileStmt => new WhileStmt(handle), + _ => new Stmt(handle, handle.Kind, handle.StmtClass), + }; } } diff --git a/sources/ClangSharp/Cursors/Stmts/SwitchCase.cs b/sources/ClangSharp/Cursors/Stmts/SwitchCase.cs index c92ebe0f..5237edff 100644 --- a/sources/ClangSharp/Cursors/Stmts/SwitchCase.cs +++ b/sources/ClangSharp/Cursors/Stmts/SwitchCase.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class SwitchCase : Stmt { - private protected SwitchCase(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected SwitchCase(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) { + if ((CX_StmtClass.CX_StmtClass_LastSwitchCase < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstSwitchCase)) + { + throw new ArgumentException(nameof(handle)); + } } } } diff --git a/sources/ClangSharp/Cursors/Stmts/SwitchStmt.cs b/sources/ClangSharp/Cursors/Stmts/SwitchStmt.cs index bc7359a9..dac7f25c 100644 --- a/sources/ClangSharp/Cursors/Stmts/SwitchStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/SwitchStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class SwitchStmt : Stmt { - internal SwitchStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_SwitchStmt) + internal SwitchStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_SwitchStmt, CX_StmtClass.CX_StmtClass_SwitchStmt) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/ValueStmt.cs b/sources/ClangSharp/Cursors/Stmts/ValueStmt.cs index 5f740563..13702e44 100644 --- a/sources/ClangSharp/Cursors/Stmts/ValueStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ValueStmt.cs @@ -1,13 +1,18 @@ // Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. +using System; using ClangSharp.Interop; namespace ClangSharp { public class ValueStmt : Stmt { - private protected ValueStmt(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + private protected ValueStmt(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind, expectedStmtClass) { + if ((CX_StmtClass.CX_StmtClass_LastValueStmt < handle.StmtClass) || (handle.StmtClass < CX_StmtClass.CX_StmtClass_FirstValueStmt)) + { + throw new ArgumentException(nameof(handle)); + } } } } diff --git a/sources/ClangSharp/Cursors/Stmts/WhileStmt.cs b/sources/ClangSharp/Cursors/Stmts/WhileStmt.cs index f6f086f7..d8869d0c 100644 --- a/sources/ClangSharp/Cursors/Stmts/WhileStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/WhileStmt.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class WhileStmt : Stmt { - internal WhileStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_WhileStmt) + internal WhileStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_WhileStmt, CX_StmtClass.CX_StmtClass_WhileStmt) { } } diff --git a/sources/ClangSharp/Types/AdjustedType.cs b/sources/ClangSharp/Types/AdjustedType.cs new file mode 100644 index 00000000..11df223f --- /dev/null +++ b/sources/ClangSharp/Types/AdjustedType.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public class AdjustedType : Type + { + internal AdjustedType(CXType handle) : this(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_Adjusted) + { + } + + private protected AdjustedType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass) + { + } + } +} diff --git a/sources/ClangSharp/Types/ArrayType.cs b/sources/ClangSharp/Types/ArrayType.cs index 598ca086..0b8c9114 100644 --- a/sources/ClangSharp/Types/ArrayType.cs +++ b/sources/ClangSharp/Types/ArrayType.cs @@ -9,7 +9,7 @@ public class ArrayType : Type { private readonly Lazy _elementType; - private protected ArrayType(CXType handle, CXTypeKind expectedKind) : base(handle, expectedKind) + private protected ArrayType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass) { _elementType = new Lazy(() => TranslationUnit.GetOrCreate(Handle.ArrayElementType)); } diff --git a/sources/ClangSharp/Types/AtomicType.cs b/sources/ClangSharp/Types/AtomicType.cs new file mode 100644 index 00000000..bb7e5b53 --- /dev/null +++ b/sources/ClangSharp/Types/AtomicType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class AtomicType : Type + { + internal AtomicType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_Atomic) + { + } + } +} diff --git a/sources/ClangSharp/Types/AttributedType.cs b/sources/ClangSharp/Types/AttributedType.cs index 0d764137..804ac555 100644 --- a/sources/ClangSharp/Types/AttributedType.cs +++ b/sources/ClangSharp/Types/AttributedType.cs @@ -9,7 +9,7 @@ public sealed class AttributedType : Type { private readonly Lazy _modifiedType; - internal AttributedType(CXType handle) : base(handle, CXTypeKind.CXType_Attributed) + internal AttributedType(CXType handle) : base(handle, CXTypeKind.CXType_Attributed, CX_TypeClass.CX_TypeClass_Attributed) { _modifiedType = new Lazy(() => TranslationUnit.GetOrCreate(Handle.ModifiedType)); } diff --git a/sources/ClangSharp/Cursors/Attrs/DeclOrTypeAttr.cs b/sources/ClangSharp/Types/AutoType.cs similarity index 63% rename from sources/ClangSharp/Cursors/Attrs/DeclOrTypeAttr.cs rename to sources/ClangSharp/Types/AutoType.cs index 777a380d..06eee44d 100644 --- a/sources/ClangSharp/Cursors/Attrs/DeclOrTypeAttr.cs +++ b/sources/ClangSharp/Types/AutoType.cs @@ -4,9 +4,9 @@ namespace ClangSharp { - public sealed class DeclOrTypeAttr : InheritableAttr + public sealed class AutoType : DeducedType { - internal DeclOrTypeAttr(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) + internal AutoType(CXType handle) : base(handle, CXTypeKind.CXType_Auto, CX_TypeClass.CX_TypeClass_Auto) { } } diff --git a/sources/ClangSharp/Types/BlockPointerType.cs b/sources/ClangSharp/Types/BlockPointerType.cs new file mode 100644 index 00000000..ce4109de --- /dev/null +++ b/sources/ClangSharp/Types/BlockPointerType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class BlockPointerType : Type + { + internal BlockPointerType(CXType handle) : base(handle, CXTypeKind.CXType_BlockPointer, CX_TypeClass.CX_TypeClass_BlockPointer) + { + } + } +} diff --git a/sources/ClangSharp/Types/BuiltinType.cs b/sources/ClangSharp/Types/BuiltinType.cs index 16072288..6fb4b111 100644 --- a/sources/ClangSharp/Types/BuiltinType.cs +++ b/sources/ClangSharp/Types/BuiltinType.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class BuiltinType : Type { - internal BuiltinType(CXType handle, CXTypeKind expectedKind) : base(handle, expectedKind) + internal BuiltinType(CXType handle) : base(handle, handle.kind, CX_TypeClass.CX_TypeClass_Builtin) { } } diff --git a/sources/ClangSharp/Types/ComplexType.cs b/sources/ClangSharp/Types/ComplexType.cs new file mode 100644 index 00000000..f0ac0315 --- /dev/null +++ b/sources/ClangSharp/Types/ComplexType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ComplexType : Type + { + internal ComplexType(CXType handle) : base(handle, CXTypeKind.CXType_Complex, CX_TypeClass.CX_TypeClass_Complex) + { + } + } +} diff --git a/sources/ClangSharp/Types/ConstantArrayType.cs b/sources/ClangSharp/Types/ConstantArrayType.cs index 9cf605bf..e619e453 100644 --- a/sources/ClangSharp/Types/ConstantArrayType.cs +++ b/sources/ClangSharp/Types/ConstantArrayType.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class ConstantArrayType : ArrayType { - internal ConstantArrayType(CXType handle) : base(handle, CXTypeKind.CXType_ConstantArray) + internal ConstantArrayType(CXType handle) : base(handle, CXTypeKind.CXType_ConstantArray, CX_TypeClass.CX_TypeClass_ConstantArray) { } diff --git a/sources/ClangSharp/Types/DecayedType.cs b/sources/ClangSharp/Types/DecayedType.cs new file mode 100644 index 00000000..feb21bab --- /dev/null +++ b/sources/ClangSharp/Types/DecayedType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class DecayedType : AdjustedType + { + internal DecayedType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_Decayed) + { + } + } +} diff --git a/sources/ClangSharp/Types/DecltypeType.cs b/sources/ClangSharp/Types/DecltypeType.cs new file mode 100644 index 00000000..743a44f9 --- /dev/null +++ b/sources/ClangSharp/Types/DecltypeType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class DecltypeType : Type + { + internal DecltypeType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_Decltype) + { + } + } +} diff --git a/sources/ClangSharp/Types/DeducedTemplateSpecializationType.cs b/sources/ClangSharp/Types/DeducedTemplateSpecializationType.cs new file mode 100644 index 00000000..576020c4 --- /dev/null +++ b/sources/ClangSharp/Types/DeducedTemplateSpecializationType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class DeducedTemplateSpecializationType : DeducedType + { + internal DeducedTemplateSpecializationType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_DeducedTemplateSpecialization) + { + } + } +} diff --git a/sources/ClangSharp/Types/DeducedType.cs b/sources/ClangSharp/Types/DeducedType.cs new file mode 100644 index 00000000..04b59cea --- /dev/null +++ b/sources/ClangSharp/Types/DeducedType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public class DeducedType : Type + { + private protected DeducedType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass) + { + } + } +} diff --git a/sources/ClangSharp/Types/DependentAddressSpaceType.cs b/sources/ClangSharp/Types/DependentAddressSpaceType.cs new file mode 100644 index 00000000..f78dba47 --- /dev/null +++ b/sources/ClangSharp/Types/DependentAddressSpaceType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class DependentAddressSpaceType : Type + { + internal DependentAddressSpaceType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_DependentAddressSpace) + { + } + } +} diff --git a/sources/ClangSharp/Types/DependentNameType.cs b/sources/ClangSharp/Types/DependentNameType.cs new file mode 100644 index 00000000..09309fe4 --- /dev/null +++ b/sources/ClangSharp/Types/DependentNameType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class DependentNameType : TypeWithKeyword + { + internal DependentNameType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_DependentName) + { + } + } +} diff --git a/sources/ClangSharp/Types/DependentSizedArrayType.cs b/sources/ClangSharp/Types/DependentSizedArrayType.cs index 62dc9ab5..086a562f 100644 --- a/sources/ClangSharp/Types/DependentSizedArrayType.cs +++ b/sources/ClangSharp/Types/DependentSizedArrayType.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class DependentSizedArrayType : ArrayType { - internal DependentSizedArrayType(CXType handle) : base(handle, CXTypeKind.CXType_DependentSizedArray) + internal DependentSizedArrayType(CXType handle) : base(handle, CXTypeKind.CXType_DependentSizedArray, CX_TypeClass.CX_TypeClass_DependentSizedArray) { } } diff --git a/sources/ClangSharp/Types/DependentSizedExtVectorType.cs b/sources/ClangSharp/Types/DependentSizedExtVectorType.cs new file mode 100644 index 00000000..ade3fcc0 --- /dev/null +++ b/sources/ClangSharp/Types/DependentSizedExtVectorType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class DependentSizedExtVectorType : Type + { + internal DependentSizedExtVectorType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_DependentSizedExtVector) + { + } + } +} diff --git a/sources/ClangSharp/Types/DependentTemplateSpecializationType.cs b/sources/ClangSharp/Types/DependentTemplateSpecializationType.cs new file mode 100644 index 00000000..9d772206 --- /dev/null +++ b/sources/ClangSharp/Types/DependentTemplateSpecializationType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class DependentTemplateSpecializationType : TypeWithKeyword + { + internal DependentTemplateSpecializationType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_DependentTemplateSpecialization) + { + } + } +} diff --git a/sources/ClangSharp/Types/DependentVectorType.cs b/sources/ClangSharp/Types/DependentVectorType.cs new file mode 100644 index 00000000..da3e2da4 --- /dev/null +++ b/sources/ClangSharp/Types/DependentVectorType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class DependentVectorType : Type + { + internal DependentVectorType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_DependentVector) + { + } + } +} diff --git a/sources/ClangSharp/Types/ElaboratedType.cs b/sources/ClangSharp/Types/ElaboratedType.cs index 3c0803cd..1fbead53 100644 --- a/sources/ClangSharp/Types/ElaboratedType.cs +++ b/sources/ClangSharp/Types/ElaboratedType.cs @@ -9,7 +9,7 @@ public sealed class ElaboratedType : TypeWithKeyword { private readonly Lazy _namedType; - internal ElaboratedType(CXType handle) : base(handle, CXTypeKind.CXType_Elaborated) + internal ElaboratedType(CXType handle) : base(handle, CXTypeKind.CXType_Elaborated, CX_TypeClass.CX_TypeClass_Elaborated) { _namedType = new Lazy(() => TranslationUnit.GetOrCreate(Handle.NamedType)); } diff --git a/sources/ClangSharp/Types/EnumType.cs b/sources/ClangSharp/Types/EnumType.cs index fbbacbc2..9d79d3e4 100644 --- a/sources/ClangSharp/Types/EnumType.cs +++ b/sources/ClangSharp/Types/EnumType.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class EnumType : TagType { - internal EnumType(CXType handle) : base(handle, CXTypeKind.CXType_Enum) + internal EnumType(CXType handle) : base(handle, CXTypeKind.CXType_Enum, CX_TypeClass.CX_TypeClass_Enum) { } } diff --git a/sources/ClangSharp/Types/ExtVectorType.cs b/sources/ClangSharp/Types/ExtVectorType.cs new file mode 100644 index 00000000..5cd09546 --- /dev/null +++ b/sources/ClangSharp/Types/ExtVectorType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ExtVectorType : Type + { + internal ExtVectorType(CXType handle) : base(handle, CXTypeKind.CXType_ExtVector, CX_TypeClass.CX_TypeClass_ExtVector) + { + } + } +} diff --git a/sources/ClangSharp/Types/FunctionNoProtoType.cs b/sources/ClangSharp/Types/FunctionNoProtoType.cs new file mode 100644 index 00000000..53a95473 --- /dev/null +++ b/sources/ClangSharp/Types/FunctionNoProtoType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class FunctionNoProtoType : FunctionType + { + internal FunctionNoProtoType(CXType handle) : base(handle, CXTypeKind.CXType_FunctionNoProto, CX_TypeClass.CX_TypeClass_FunctionNoProto) + { + } + } +} diff --git a/sources/ClangSharp/Types/FunctionProtoType.cs b/sources/ClangSharp/Types/FunctionProtoType.cs index eb2fdfcd..ded15ac2 100644 --- a/sources/ClangSharp/Types/FunctionProtoType.cs +++ b/sources/ClangSharp/Types/FunctionProtoType.cs @@ -9,7 +9,7 @@ public sealed class FunctionProtoType : FunctionType { private Type[] _paramTypes; - internal FunctionProtoType(CXType handle) : base(handle, CXTypeKind.CXType_FunctionProto) + internal FunctionProtoType(CXType handle) : base(handle, CXTypeKind.CXType_FunctionProto, CX_TypeClass.CX_TypeClass_FunctionProto) { } diff --git a/sources/ClangSharp/Types/FunctionType.cs b/sources/ClangSharp/Types/FunctionType.cs index 75f9c160..61c07b93 100644 --- a/sources/ClangSharp/Types/FunctionType.cs +++ b/sources/ClangSharp/Types/FunctionType.cs @@ -9,7 +9,7 @@ public class FunctionType : Type { private readonly Lazy _returnType; - private protected FunctionType(CXType handle, CXTypeKind expectedKind) : base(handle, expectedKind) + private protected FunctionType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass) { _returnType = new Lazy(() => TranslationUnit.GetOrCreate(Handle.ResultType)); } diff --git a/sources/ClangSharp/Types/IncompleteArrayType.cs b/sources/ClangSharp/Types/IncompleteArrayType.cs index 88c03639..a3347fbb 100644 --- a/sources/ClangSharp/Types/IncompleteArrayType.cs +++ b/sources/ClangSharp/Types/IncompleteArrayType.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class IncompleteArrayType : ArrayType { - internal IncompleteArrayType(CXType handle) : base(handle, CXTypeKind.CXType_IncompleteArray) + internal IncompleteArrayType(CXType handle) : base(handle, CXTypeKind.CXType_IncompleteArray, CX_TypeClass.CX_TypeClass_IncompleteArray) { } } diff --git a/sources/ClangSharp/Types/InjectedClassNameType.cs b/sources/ClangSharp/Types/InjectedClassNameType.cs new file mode 100644 index 00000000..1552ba91 --- /dev/null +++ b/sources/ClangSharp/Types/InjectedClassNameType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class InjectedClassNameType : Type + { + internal InjectedClassNameType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_InjectedClassName) + { + } + } +} diff --git a/sources/ClangSharp/Types/LValueReferenceType.cs b/sources/ClangSharp/Types/LValueReferenceType.cs index 0f4e300c..75257b1a 100644 --- a/sources/ClangSharp/Types/LValueReferenceType.cs +++ b/sources/ClangSharp/Types/LValueReferenceType.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class LValueReferenceType : ReferenceType { - internal LValueReferenceType(CXType handle) : base(handle, CXTypeKind.CXType_LValueReference) + internal LValueReferenceType(CXType handle) : base(handle, CXTypeKind.CXType_LValueReference, CX_TypeClass.CX_TypeClass_LValueReference) { } } diff --git a/sources/ClangSharp/Types/MacroQualifiedType.cs b/sources/ClangSharp/Types/MacroQualifiedType.cs new file mode 100644 index 00000000..68303b88 --- /dev/null +++ b/sources/ClangSharp/Types/MacroQualifiedType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class MacroQualifiedType : Type + { + internal MacroQualifiedType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_MacroQualified) + { + } + } +} diff --git a/sources/ClangSharp/Types/MemberPointerType.cs b/sources/ClangSharp/Types/MemberPointerType.cs new file mode 100644 index 00000000..51985279 --- /dev/null +++ b/sources/ClangSharp/Types/MemberPointerType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class MemberPointerType : Type + { + internal MemberPointerType(CXType handle) : base(handle, CXTypeKind.CXType_MemberPointer, CX_TypeClass.CX_TypeClass_MemberPointer) + { + } + } +} diff --git a/sources/ClangSharp/Types/ObjCInterfaceType.cs b/sources/ClangSharp/Types/ObjCInterfaceType.cs new file mode 100644 index 00000000..8b1a7b42 --- /dev/null +++ b/sources/ClangSharp/Types/ObjCInterfaceType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ObjCInterfaceType : ObjCObjectType + { + internal ObjCInterfaceType(CXType handle) : base(handle, CXTypeKind.CXType_ObjCObject, CX_TypeClass.CX_TypeClass_ObjCInterface) + { + } + } +} diff --git a/sources/ClangSharp/Types/ObjCObjectPointerType.cs b/sources/ClangSharp/Types/ObjCObjectPointerType.cs new file mode 100644 index 00000000..ffefdd91 --- /dev/null +++ b/sources/ClangSharp/Types/ObjCObjectPointerType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ObjCObjectPointerType : Type + { + internal ObjCObjectPointerType(CXType handle) : base(handle, CXTypeKind.CXType_ObjCObjectPointer, CX_TypeClass.CX_TypeClass_ObjCObjectPointer) + { + } + } +} diff --git a/sources/ClangSharp/Types/ObjCObjectType.cs b/sources/ClangSharp/Types/ObjCObjectType.cs new file mode 100644 index 00000000..7244a2b8 --- /dev/null +++ b/sources/ClangSharp/Types/ObjCObjectType.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public class ObjCObjectType : Type + { + internal ObjCObjectType(CXType handle) : this(handle, CXTypeKind.CXType_ObjCObject, CX_TypeClass.CX_TypeClass_ObjCObject) + { + } + + private protected ObjCObjectType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass) + { + } + } +} diff --git a/sources/ClangSharp/Types/ObjCTypeParamType.cs b/sources/ClangSharp/Types/ObjCTypeParamType.cs new file mode 100644 index 00000000..7623ebf3 --- /dev/null +++ b/sources/ClangSharp/Types/ObjCTypeParamType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ObjCTypeParamType : Type + { + internal ObjCTypeParamType(CXType handle) : base(handle, CXTypeKind.CXType_ObjCTypeParam, CX_TypeClass.CX_TypeClass_ObjCTypeParam) + { + } + } +} diff --git a/sources/ClangSharp/Types/PackExpansionType.cs b/sources/ClangSharp/Types/PackExpansionType.cs new file mode 100644 index 00000000..c094f118 --- /dev/null +++ b/sources/ClangSharp/Types/PackExpansionType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class PackExpansionType : Type + { + internal PackExpansionType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_PackExpansion) + { + } + } +} diff --git a/sources/ClangSharp/Types/ParenType.cs b/sources/ClangSharp/Types/ParenType.cs new file mode 100644 index 00000000..0c87108f --- /dev/null +++ b/sources/ClangSharp/Types/ParenType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class ParenType : Type + { + internal ParenType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_Paren) + { + } + } +} diff --git a/sources/ClangSharp/Types/PipeType.cs b/sources/ClangSharp/Types/PipeType.cs new file mode 100644 index 00000000..d0fd94fe --- /dev/null +++ b/sources/ClangSharp/Types/PipeType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class PipeType : Type + { + internal PipeType(CXType handle) : base(handle, CXTypeKind.CXType_Pipe, CX_TypeClass.CX_TypeClass_Pipe) + { + } + } +} diff --git a/sources/ClangSharp/Types/PointerType.cs b/sources/ClangSharp/Types/PointerType.cs index 6d5fcba2..c7076e8e 100644 --- a/sources/ClangSharp/Types/PointerType.cs +++ b/sources/ClangSharp/Types/PointerType.cs @@ -9,7 +9,7 @@ public sealed class PointerType : Type { private readonly Lazy _pointeeType; - internal PointerType(CXType handle) : base(handle, CXTypeKind.CXType_Pointer) + internal PointerType(CXType handle) : base(handle, CXTypeKind.CXType_Pointer, CX_TypeClass.CX_TypeClass_Pointer) { _pointeeType = new Lazy(() => TranslationUnit.GetOrCreate(Handle.PointeeType)); } diff --git a/sources/ClangSharp/Types/RValueReferenceType.cs b/sources/ClangSharp/Types/RValueReferenceType.cs new file mode 100644 index 00000000..0097b09d --- /dev/null +++ b/sources/ClangSharp/Types/RValueReferenceType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class RValueReferenceType : ReferenceType + { + internal RValueReferenceType(CXType handle) : base(handle, CXTypeKind.CXType_RValueReference, CX_TypeClass.CX_TypeClass_RValueReference) + { + } + } +} diff --git a/sources/ClangSharp/Types/RecordType.cs b/sources/ClangSharp/Types/RecordType.cs index f6507f7d..4b08d0d7 100644 --- a/sources/ClangSharp/Types/RecordType.cs +++ b/sources/ClangSharp/Types/RecordType.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public sealed class RecordType : TagType { - internal RecordType(CXType handle) : base(handle, CXTypeKind.CXType_Record) + internal RecordType(CXType handle) : base(handle, CXTypeKind.CXType_Record, CX_TypeClass.CX_TypeClass_Record) { } } diff --git a/sources/ClangSharp/Types/ReferenceType.cs b/sources/ClangSharp/Types/ReferenceType.cs index 56c567a0..96dc7a94 100644 --- a/sources/ClangSharp/Types/ReferenceType.cs +++ b/sources/ClangSharp/Types/ReferenceType.cs @@ -9,7 +9,7 @@ public class ReferenceType : Type { private readonly Lazy _pointeeType; - private protected ReferenceType(CXType handle, CXTypeKind expectedKind) : base(handle, expectedKind) + private protected ReferenceType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass) { _pointeeType = new Lazy(() => TranslationUnit.GetOrCreate(Handle.PointeeType)); } diff --git a/sources/ClangSharp/Types/SubstTemplateTypeParmPackType.cs b/sources/ClangSharp/Types/SubstTemplateTypeParmPackType.cs new file mode 100644 index 00000000..170f1383 --- /dev/null +++ b/sources/ClangSharp/Types/SubstTemplateTypeParmPackType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class SubstTemplateTypeParmPackType : Type + { + internal SubstTemplateTypeParmPackType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_SubstTemplateTypeParmPack) + { + } + } +} diff --git a/sources/ClangSharp/Types/SubstTemplateTypeParmType.cs b/sources/ClangSharp/Types/SubstTemplateTypeParmType.cs new file mode 100644 index 00000000..ddbb860c --- /dev/null +++ b/sources/ClangSharp/Types/SubstTemplateTypeParmType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class SubstTemplateTypeParmType : Type + { + internal SubstTemplateTypeParmType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_SubstTemplateTypeParm) + { + } + } +} diff --git a/sources/ClangSharp/Types/TagType.cs b/sources/ClangSharp/Types/TagType.cs index 586fe49f..eded4e7a 100644 --- a/sources/ClangSharp/Types/TagType.cs +++ b/sources/ClangSharp/Types/TagType.cs @@ -9,7 +9,7 @@ public class TagType : Type { private readonly Lazy _decl; - private protected TagType(CXType handle, CXTypeKind expectedKind) : base(handle, expectedKind) + private protected TagType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass) { _decl = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Declaration)); } diff --git a/sources/ClangSharp/Types/TemplateSpecializationType.cs b/sources/ClangSharp/Types/TemplateSpecializationType.cs new file mode 100644 index 00000000..fc22aba0 --- /dev/null +++ b/sources/ClangSharp/Types/TemplateSpecializationType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class TemplateSpecializationType : Type + { + internal TemplateSpecializationType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_TemplateSpecialization) + { + } + } +} diff --git a/sources/ClangSharp/Types/TemplateTypeParmType.cs b/sources/ClangSharp/Types/TemplateTypeParmType.cs new file mode 100644 index 00000000..affdfe3d --- /dev/null +++ b/sources/ClangSharp/Types/TemplateTypeParmType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class TemplateTypeParmType : Type + { + internal TemplateTypeParmType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_TemplateTypeParm) + { + } + } +} diff --git a/sources/ClangSharp/Types/Type.cs b/sources/ClangSharp/Types/Type.cs index a9f17067..3d9f7226 100644 --- a/sources/ClangSharp/Types/Type.cs +++ b/sources/ClangSharp/Types/Type.cs @@ -11,12 +11,17 @@ public unsafe class Type : IEquatable private readonly Lazy _canonicalType; private readonly Lazy _translationUnit; - protected Type(CXType handle, CXTypeKind expectedKind) + protected Type(CXType handle, CXTypeKind expectedKind, CX_TypeClass expectedTypeClass) { if (handle.kind != expectedKind) { throw new ArgumentException(nameof(handle)); } + + if ((handle.TypeClass == CX_TypeClass.CX_TypeClass_Invalid) || (handle.TypeClass != expectedTypeClass)) + { + throw new ArgumentException(nameof(handle)); + } Handle = handle; _canonicalType = new Lazy(() => TranslationUnit.GetOrCreate(Handle.CanonicalType)); @@ -37,123 +42,64 @@ protected Type(CXType handle, CXTypeKind expectedKind) public TranslationUnit TranslationUnit => _translationUnit.Value; + public CX_TypeClass TypeClass => Handle.TypeClass; + public static bool operator ==(Type left, Type right) => (left is object) ? ((right is object) && (left.Handle == right.Handle)) : (right is null); public static bool operator !=(Type left, Type right) => (left is object) ? ((right is null) || (left.Handle != right.Handle)) : (right is object); - internal static Type Create(CXType handle) + internal static Type Create(CXType handle) => handle.TypeClass switch { - Type result; - - switch (handle.kind) - { - case CXTypeKind.CXType_Unexposed: - { - result = new Type(handle, CXTypeKind.CXType_Unexposed); - break; - } - - case CXTypeKind.CXType_Void: - case CXTypeKind.CXType_Bool: - case CXTypeKind.CXType_Char_U: - case CXTypeKind.CXType_UChar: - case CXTypeKind.CXType_UShort: - case CXTypeKind.CXType_UInt: - case CXTypeKind.CXType_ULong: - case CXTypeKind.CXType_ULongLong: - case CXTypeKind.CXType_Char_S: - case CXTypeKind.CXType_SChar: - case CXTypeKind.CXType_WChar: - case CXTypeKind.CXType_Short: - case CXTypeKind.CXType_Int: - case CXTypeKind.CXType_Long: - case CXTypeKind.CXType_LongLong: - case CXTypeKind.CXType_Float: - case CXTypeKind.CXType_Double: - case CXTypeKind.CXType_LongDouble: - case CXTypeKind.CXType_NullPtr: - case CXTypeKind.CXType_Dependent: - { - result = new BuiltinType(handle, handle.kind); - break; - } - - case CXTypeKind.CXType_Pointer: - { - result = new PointerType(handle); - break; - } - - case CXTypeKind.CXType_LValueReference: - { - result = new LValueReferenceType(handle); - break; - } - - case CXTypeKind.CXType_Record: - { - result = new RecordType(handle); - break; - } - - case CXTypeKind.CXType_Enum: - { - result = new EnumType(handle); - break; - } - - case CXTypeKind.CXType_Typedef: - { - result = new TypedefType(handle); - break; - } - - case CXTypeKind.CXType_FunctionProto: - { - result = new FunctionProtoType(handle); - break; - } - - case CXTypeKind.CXType_ConstantArray: - { - result = new ConstantArrayType(handle); - break; - } - - case CXTypeKind.CXType_IncompleteArray: - { - result = new IncompleteArrayType(handle); - break; - } - - case CXTypeKind.CXType_DependentSizedArray: - { - result = new DependentSizedArrayType(handle); - break; - } - - case CXTypeKind.CXType_Elaborated: - { - result = new ElaboratedType(handle); - break; - } - - case CXTypeKind.CXType_Attributed: - { - result = new AttributedType(handle); - break; - } - - default: - { - Debug.WriteLine($"Unhandled type kind: {handle.KindSpelling}."); - result = new Type(handle, handle.kind); - break; - } - } - - return result; - } + CX_TypeClass.CX_TypeClass_Builtin => new BuiltinType(handle), + CX_TypeClass.CX_TypeClass_Complex => new ComplexType(handle), + CX_TypeClass.CX_TypeClass_Pointer => new PointerType(handle), + CX_TypeClass.CX_TypeClass_BlockPointer => new BlockPointerType(handle), + CX_TypeClass.CX_TypeClass_LValueReference => new LValueReferenceType(handle), + CX_TypeClass.CX_TypeClass_RValueReference => new RValueReferenceType(handle), + CX_TypeClass.CX_TypeClass_MemberPointer => new MemberPointerType(handle), + CX_TypeClass.CX_TypeClass_ConstantArray => new ConstantArrayType(handle), + CX_TypeClass.CX_TypeClass_IncompleteArray => new IncompleteArrayType(handle), + CX_TypeClass.CX_TypeClass_VariableArray => new VariableArrayType(handle), + CX_TypeClass.CX_TypeClass_DependentSizedArray => new DependentSizedArrayType(handle), + CX_TypeClass.CX_TypeClass_DependentSizedExtVector => new DependentSizedExtVectorType(handle), + CX_TypeClass.CX_TypeClass_DependentAddressSpace => new DependentAddressSpaceType(handle), + CX_TypeClass.CX_TypeClass_Vector => new VectorType(handle), + CX_TypeClass.CX_TypeClass_DependentVector => new DependentVectorType(handle), + CX_TypeClass.CX_TypeClass_ExtVector => new ExtVectorType(handle), + CX_TypeClass.CX_TypeClass_FunctionProto => new FunctionProtoType(handle), + CX_TypeClass.CX_TypeClass_FunctionNoProto => new FunctionNoProtoType(handle), + CX_TypeClass.CX_TypeClass_UnresolvedUsing => new UnresolvedUsingType(handle), + CX_TypeClass.CX_TypeClass_Paren => new ParenType(handle), + CX_TypeClass.CX_TypeClass_Typedef => new TypedefType(handle), + CX_TypeClass.CX_TypeClass_MacroQualified => new MacroQualifiedType(handle), + CX_TypeClass.CX_TypeClass_Adjusted => new AdjustedType(handle), + CX_TypeClass.CX_TypeClass_Decayed => new DecayedType(handle), + CX_TypeClass.CX_TypeClass_TypeOfExpr => new TypeOfExprType(handle), + CX_TypeClass.CX_TypeClass_TypeOf => new TypeOfType(handle), + CX_TypeClass.CX_TypeClass_Decltype => new DecltypeType(handle), + CX_TypeClass.CX_TypeClass_UnaryTransform => new UnaryTransformType(handle), + CX_TypeClass.CX_TypeClass_Record => new RecordType(handle), + CX_TypeClass.CX_TypeClass_Enum => new EnumType(handle), + CX_TypeClass.CX_TypeClass_Elaborated => new ElaboratedType(handle), + CX_TypeClass.CX_TypeClass_Attributed => new AttributedType(handle), + CX_TypeClass.CX_TypeClass_TemplateTypeParm => new TemplateTypeParmType(handle), + CX_TypeClass.CX_TypeClass_SubstTemplateTypeParm => new SubstTemplateTypeParmType(handle), + CX_TypeClass.CX_TypeClass_SubstTemplateTypeParmPack => new SubstTemplateTypeParmPackType(handle), + CX_TypeClass.CX_TypeClass_TemplateSpecialization => new TemplateSpecializationType(handle), + CX_TypeClass.CX_TypeClass_Auto => new AutoType(handle), + CX_TypeClass.CX_TypeClass_DeducedTemplateSpecialization => new DeducedTemplateSpecializationType(handle), + CX_TypeClass.CX_TypeClass_InjectedClassName => new InjectedClassNameType(handle), + CX_TypeClass.CX_TypeClass_DependentName => new DependentNameType(handle), + CX_TypeClass.CX_TypeClass_DependentTemplateSpecialization => new DependentTemplateSpecializationType(handle), + CX_TypeClass.CX_TypeClass_PackExpansion => new PackExpansionType(handle), + CX_TypeClass.CX_TypeClass_ObjCTypeParam => new ObjCTypeParamType(handle), + CX_TypeClass.CX_TypeClass_ObjCObject => new ObjCObjectType(handle), + CX_TypeClass.CX_TypeClass_ObjCInterface => new ObjCInterfaceType(handle), + CX_TypeClass.CX_TypeClass_ObjCObjectPointer => new ObjCObjectPointerType(handle), + CX_TypeClass.CX_TypeClass_Pipe => new PipeType(handle), + CX_TypeClass.CX_TypeClass_Atomic => new AtomicType(handle), + _ => new Type(handle, handle.kind, handle.TypeClass), + }; public override bool Equals(object obj) => (obj is Type other) && Equals(other); diff --git a/sources/ClangSharp/Types/TypeOfExprType.cs b/sources/ClangSharp/Types/TypeOfExprType.cs new file mode 100644 index 00000000..8d3ac4c2 --- /dev/null +++ b/sources/ClangSharp/Types/TypeOfExprType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class TypeOfExprType : Type + { + internal TypeOfExprType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_TypeOfExpr) + { + } + } +} diff --git a/sources/ClangSharp/Types/TypeOfType.cs b/sources/ClangSharp/Types/TypeOfType.cs new file mode 100644 index 00000000..1ef6a854 --- /dev/null +++ b/sources/ClangSharp/Types/TypeOfType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class TypeOfType : Type + { + internal TypeOfType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_TypeOf) + { + } + } +} diff --git a/sources/ClangSharp/Types/TypeWithKeyword.cs b/sources/ClangSharp/Types/TypeWithKeyword.cs index cbfd8718..9e219ab5 100644 --- a/sources/ClangSharp/Types/TypeWithKeyword.cs +++ b/sources/ClangSharp/Types/TypeWithKeyword.cs @@ -6,7 +6,7 @@ namespace ClangSharp { public class TypeWithKeyword : Type { - private protected TypeWithKeyword(CXType handle, CXTypeKind expectedKind) : base(handle, expectedKind) + private protected TypeWithKeyword(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass) { } } diff --git a/sources/ClangSharp/Types/TypedefType.cs b/sources/ClangSharp/Types/TypedefType.cs index e9e9c26b..d731d2a0 100644 --- a/sources/ClangSharp/Types/TypedefType.cs +++ b/sources/ClangSharp/Types/TypedefType.cs @@ -9,7 +9,7 @@ public sealed class TypedefType : Type { private readonly Lazy _decl; - internal TypedefType(CXType handle) : base(handle, CXTypeKind.CXType_Typedef) + internal TypedefType(CXType handle) : base(handle, CXTypeKind.CXType_Typedef, CX_TypeClass.CX_TypeClass_Typedef) { _decl = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Declaration)); } diff --git a/sources/ClangSharp/Types/UnaryTransformType.cs b/sources/ClangSharp/Types/UnaryTransformType.cs new file mode 100644 index 00000000..2654c48d --- /dev/null +++ b/sources/ClangSharp/Types/UnaryTransformType.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public class UnaryTransformType : Type + { + internal UnaryTransformType(CXType handle) : this(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_UnaryTransform) + { + } + + private protected UnaryTransformType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass) + { + } + } +} diff --git a/sources/ClangSharp/Types/UnresolvedUsingType.cs b/sources/ClangSharp/Types/UnresolvedUsingType.cs new file mode 100644 index 00000000..85d944a4 --- /dev/null +++ b/sources/ClangSharp/Types/UnresolvedUsingType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class UnresolvedUsingType : Type + { + internal UnresolvedUsingType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_UnresolvedUsing) + { + } + } +} diff --git a/sources/ClangSharp/Types/VariableArrayType.cs b/sources/ClangSharp/Types/VariableArrayType.cs new file mode 100644 index 00000000..7e1edc9d --- /dev/null +++ b/sources/ClangSharp/Types/VariableArrayType.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public sealed class VariableArrayType : ArrayType + { + internal VariableArrayType(CXType handle) : base(handle, CXTypeKind.CXType_VariableArray, CX_TypeClass.CX_TypeClass_VariableArray) + { + } + } +} diff --git a/sources/ClangSharp/Types/VectorType.cs b/sources/ClangSharp/Types/VectorType.cs new file mode 100644 index 00000000..042e16e1 --- /dev/null +++ b/sources/ClangSharp/Types/VectorType.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using ClangSharp.Interop; + +namespace ClangSharp +{ + public class VectorType : Type + { + internal VectorType(CXType handle) : base(handle, CXTypeKind.CXType_Vector, CX_TypeClass.CX_TypeClass_Vector) + { + } + + private protected VectorType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass) + { + } + } +}