From 45fab8529512321a526decb13febaad7e19f3f9e Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Wed, 17 Apr 2024 18:20:11 +0100 Subject: [PATCH] Re-export all AST types in the C and C++ domains --- CHANGES.rst | 2 + sphinx/domains/c/__init__.py | 53 ++++++++++++++++++++ sphinx/domains/cpp/__init__.py | 92 ++++++++++++++++++++++++++++++++++ 3 files changed, 147 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index cf0aadf13be..73490ffcc88 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,8 @@ Release 7.3.6 (in development) Bugs fixed ---------- +* #12295: Re-export all AST types in the C and C++ domains. + Patch by Adam Turner. Release 7.3.5 (released Apr 17, 2024) ===================================== diff --git a/sphinx/domains/c/__init__.py b/sphinx/domains/c/__init__.py index 7a68606bcc8..903fa4c8bce 100644 --- a/sphinx/domains/c/__init__.py +++ b/sphinx/domains/c/__init__.py @@ -44,6 +44,59 @@ from sphinx.environment import BuildEnvironment from sphinx.util.typing import ExtensionMetadata, OptionSpec +# re-export objects for backwards compatibility +# xref https://github.com/sphinx-doc/sphinx/issues/12295 +from sphinx.domains.c._ast import ( # NoQA: F401 + ASTAlignofExpr, + ASTArray, + ASTAssignmentExpr, + ASTBase, + ASTBinOpExpr, + ASTBooleanLiteral, + ASTBracedInitList, + ASTCastExpr, + ASTCharLiteral, + ASTDeclarator, + ASTDeclaratorNameBitField, + ASTDeclaratorNameParam, + ASTDeclaratorParen, + ASTDeclaratorPtr, + ASTDeclSpecs, + ASTDeclSpecsSimple, + ASTEnum, + ASTEnumerator, + ASTExpression, + ASTFallbackExpr, + ASTFunctionParameter, + ASTIdExpression, + ASTInitializer, + ASTLiteral, + ASTMacro, + ASTMacroParameter, + ASTNumberLiteral, + ASTParameters, + ASTParenExpr, + ASTParenExprList, + ASTPostfixArray, + ASTPostfixCallExpr, + ASTPostfixDec, + ASTPostfixExpr, + ASTPostfixInc, + ASTPostfixMemberOfPointer, + ASTPostfixOp, + ASTSizeofExpr, + ASTSizeofType, + ASTStringLiteral, + ASTStruct, + ASTTrailingTypeSpec, + ASTTrailingTypeSpecFundamental, + ASTTrailingTypeSpecName, + ASTType, + ASTTypeWithInit, + ASTUnaryOpExpr, + ASTUnion, +) + logger = logging.getLogger(__name__) diff --git a/sphinx/domains/cpp/__init__.py b/sphinx/domains/cpp/__init__.py index 872b09ec93e..9e1f075f8b7 100644 --- a/sphinx/domains/cpp/__init__.py +++ b/sphinx/domains/cpp/__init__.py @@ -48,6 +48,98 @@ from sphinx.environment import BuildEnvironment from sphinx.util.typing import ExtensionMetadata, OptionSpec +# re-export objects for backwards compatibility +# xref https://github.com/sphinx-doc/sphinx/issues/12295 +from sphinx.domains.cpp._ast import ( # NoQA: F401 + ASTAlignofExpr, + ASTArray, + ASTAssignmentExpr, + ASTBase, + ASTBaseClass, + ASTBinOpExpr, + ASTBooleanLiteral, + ASTBracedInitList, + ASTCastExpr, + ASTCharLiteral, + ASTClass, + ASTCommaExpr, + ASTConcept, + ASTConditionalExpr, + ASTDeclarator, + ASTDeclaratorMemPtr, + ASTDeclaratorNameBitField, + ASTDeclaratorNameParamQual, + ASTDeclaratorParamPack, + ASTDeclaratorParen, + ASTDeclaratorPtr, + ASTDeclaratorRef, + ASTDeclSpecs, + ASTDeclSpecsSimple, + ASTDeleteExpr, + ASTEnum, + ASTEnumerator, + ASTExplicitCast, + ASTExplicitSpec, + ASTExpression, + ASTFallbackExpr, + ASTFoldExpr, + ASTFunctionParameter, + ASTIdExpression, + ASTInitializer, + ASTLiteral, + ASTNewExpr, + ASTNoexceptExpr, + ASTNoexceptSpec, + ASTNumberLiteral, + ASTOperator, + ASTOperatorBuildIn, + ASTOperatorLiteral, + ASTOperatorType, + ASTPackExpansionExpr, + ASTParametersQualifiers, + ASTParenExpr, + ASTParenExprList, + ASTPointerLiteral, + ASTPostfixArray, + ASTPostfixCallExpr, + ASTPostfixDec, + ASTPostfixExpr, + ASTPostfixInc, + ASTPostfixMember, + ASTPostfixMemberOfPointer, + ASTPostfixOp, + ASTRequiresClause, + ASTSizeofExpr, + ASTSizeofParamPack, + ASTSizeofType, + ASTStringLiteral, + ASTTemplateArgConstant, + ASTTemplateArgs, + ASTTemplateDeclarationPrefix, + ASTTemplateIntroduction, + ASTTemplateIntroductionParameter, + ASTTemplateKeyParamPackIdDefault, + ASTTemplateParam, + ASTTemplateParamConstrainedTypeWithInit, + ASTTemplateParamNonType, + ASTTemplateParams, + ASTTemplateParamTemplateType, + ASTTemplateParamType, + ASTThisLiteral, + ASTTrailingTypeSpec, + ASTTrailingTypeSpecDecltype, + ASTTrailingTypeSpecDecltypeAuto, + ASTTrailingTypeSpecFundamental, + ASTTrailingTypeSpecName, + ASTType, + ASTTypeId, + ASTTypeUsing, + ASTTypeWithInit, + ASTUnaryOpExpr, + ASTUnion, + ASTUserDefinedLiteral, +) + logger = logging.getLogger(__name__)