Skip to content

Commit 21f968b

Browse files
authored
[AutoDiff] NFC: use triple slashes for doc comments. (#32755)
1 parent 063d420 commit 21f968b

File tree

1 file changed

+45
-44
lines changed

1 file changed

+45
-44
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3417,7 +3417,7 @@ DynamicallyReplacedDeclRequest::evaluate(Evaluator &evaluator,
34173417
}
34183418

34193419
/// Returns true if the given type conforms to `Differentiable` in the given
3420-
/// contxt. If `tangentVectorEqualsSelf` is true, also check whether the given
3420+
/// context. If `tangentVectorEqualsSelf` is true, also check whether the given
34213421
/// type satisfies `TangentVector == Self`.
34223422
static bool conformsToDifferentiable(Type type, DeclContext *DC,
34233423
bool tangentVectorEqualsSelf = false) {
@@ -3480,13 +3480,13 @@ IndexSubset *TypeChecker::inferDifferentiabilityParameters(
34803480
return IndexSubset::get(ctx, parameterBits);
34813481
}
34823482

3483-
// Computes the differentiability parameter indices from the given parsed
3484-
// differentiability parameters for the given original or derivative
3485-
// `AbstractFunctionDecl` and derivative generic environment. On error, emits
3486-
// diagnostics and returns `nullptr`.
3487-
// - If parsed parameters are empty, infer parameter indices.
3488-
// - Otherwise, build parameter indices from parsed parameters.
3489-
// The attribute name/location are used in diagnostics.
3483+
/// Computes the differentiability parameter indices from the given parsed
3484+
/// differentiability parameters for the given original or derivative
3485+
/// `AbstractFunctionDecl` and derivative generic environment. On error, emits
3486+
/// diagnostics and returns `nullptr`.
3487+
/// - If parsed parameters are empty, infer parameter indices.
3488+
/// - Otherwise, build parameter indices from parsed parameters.
3489+
/// The attribute name/location are used in diagnostics.
34903490
static IndexSubset *computeDifferentiabilityParameters(
34913491
ArrayRef<ParsedAutoDiffParameter> parsedDiffParams,
34923492
AbstractFunctionDecl *function, GenericEnvironment *derivativeGenEnv,
@@ -3645,17 +3645,17 @@ enum class AbstractFunctionDeclLookupErrorKind {
36453645
CandidateNotFunctionDeclaration
36463646
};
36473647

3648-
// Returns the function declaration corresponding to the given base type
3649-
// (optional), function name, and lookup context.
3650-
//
3651-
// If the base type of the function is specified, member lookup is performed.
3652-
// Otherwise, unqualified lookup is performed.
3653-
//
3654-
// If the function declaration cannot be resolved, emits a diagnostic and
3655-
// returns nullptr.
3656-
//
3657-
// Used for resolving the referenced declaration in `@derivative` and
3658-
// `@transpose` attributes.
3648+
/// Returns the function declaration corresponding to the given base type
3649+
/// (optional), function name, and lookup context.
3650+
///
3651+
/// If the base type of the function is specified, member lookup is performed.
3652+
/// Otherwise, unqualified lookup is performed.
3653+
///
3654+
/// If the function declaration cannot be resolved, emits a diagnostic and
3655+
/// returns nullptr.
3656+
///
3657+
/// Used for resolving the referenced declaration in `@derivative` and
3658+
/// `@transpose` attributes.
36593659
static AbstractFunctionDecl *findAbstractFunctionDecl(
36603660
DeclAttribute *attr, Type baseType, DeclNameRefWithLoc funcNameWithLoc,
36613661
DeclContext *lookupContext, NameLookupOptions lookupOptions,
@@ -3818,10 +3818,10 @@ static AbstractFunctionDecl *findAbstractFunctionDecl(
38183818
return validCandidates.front();
38193819
}
38203820

3821-
// Checks that the `candidate` function type equals the `required` function
3822-
// type, disregarding parameter labels and tuple result labels.
3823-
// `checkGenericSignature` is used to check generic signatures, if specified.
3824-
// Otherwise, generic signatures are checked for equality.
3821+
/// Checks that the `candidate` function type equals the `required` function
3822+
/// type, disregarding parameter labels and tuple result labels.
3823+
/// `checkGenericSignature` is used to check generic signatures, if specified.
3824+
/// Otherwise, generic signatures are checked for equality.
38253825
static bool checkFunctionSignature(
38263826
CanAnyFunctionType required, CanType candidate,
38273827
Optional<std::function<bool(GenericSignature, GenericSignature)>>
@@ -3890,8 +3890,8 @@ static bool checkFunctionSignature(
38903890
return checkFunctionSignature(requiredResultFnTy, candidateResultTy);
38913891
};
38923892

3893-
// Returns an `AnyFunctionType` from the given parameters, result type, and
3894-
// generic signature.
3893+
/// Returns an `AnyFunctionType` from the given parameters, result type, and
3894+
/// generic signature.
38953895
static AnyFunctionType *
38963896
makeFunctionType(ArrayRef<AnyFunctionType::Param> parameters, Type resultType,
38973897
GenericSignature genericSignature) {
@@ -3900,8 +3900,8 @@ makeFunctionType(ArrayRef<AnyFunctionType::Param> parameters, Type resultType,
39003900
return FunctionType::get(parameters, resultType);
39013901
}
39023902

3903-
// Computes the original function type corresponding to the given derivative
3904-
// function type. Used for `@derivative` attribute type-checking.
3903+
/// Computes the original function type corresponding to the given derivative
3904+
/// function type. Used for `@derivative` attribute type-checking.
39053905
static AnyFunctionType *
39063906
getDerivativeOriginalFunctionType(AnyFunctionType *derivativeFnTy) {
39073907
// Unwrap curry levels. At most, two parameter lists are necessary, for
@@ -3940,8 +3940,8 @@ getDerivativeOriginalFunctionType(AnyFunctionType *derivativeFnTy) {
39403940
return originalType;
39413941
}
39423942

3943-
// Computes the original function type corresponding to the given transpose
3944-
// function type. Used for `@transpose` attribute type-checking.
3943+
/// Computes the original function type corresponding to the given transpose
3944+
/// function type. Used for `@transpose` attribute type-checking.
39453945
static AnyFunctionType *
39463946
getTransposeOriginalFunctionType(AnyFunctionType *transposeFnType,
39473947
IndexSubset *linearParamIndices,
@@ -4878,11 +4878,11 @@ DerivativeAttrOriginalDeclRequest::evaluate(Evaluator &evaluator,
48784878
return nullptr;
48794879
}
48804880

4881-
// Computes the linearity parameter indices from the given parsed linearity
4882-
// parameters for the given transpose function. On error, emits diagnostics and
4883-
// returns `nullptr`.
4884-
//
4885-
// The attribute location is used in diagnostics.
4881+
/// Computes the linearity parameter indices from the given parsed linearity
4882+
/// parameters for the given transpose function. On error, emits diagnostics and
4883+
/// returns `nullptr`.
4884+
///
4885+
/// The attribute location is used in diagnostics.
48864886
static IndexSubset *
48874887
computeLinearityParameters(ArrayRef<ParsedAutoDiffParameter> parsedLinearParams,
48884888
AbstractFunctionDecl *transposeFunction,
@@ -4969,12 +4969,12 @@ computeLinearityParameters(ArrayRef<ParsedAutoDiffParameter> parsedLinearParams,
49694969
return IndexSubset::get(ctx, parameterBits);
49704970
}
49714971

4972-
// Checks if the given linearity parameter types are valid for the given
4973-
// original function in the given derivative generic environment and module
4974-
// context. Returns true on error.
4975-
//
4976-
// The parsed differentiability parameters and attribute location are used in
4977-
// diagnostics.
4972+
/// Checks if the given linearity parameter types are valid for the given
4973+
/// original function in the given derivative generic environment and module
4974+
/// context. Returns true on error.
4975+
///
4976+
/// The parsed differentiability parameters and attribute location are used in
4977+
/// diagnostics.
49784978
static bool checkLinearityParameters(
49794979
AbstractFunctionDecl *originalAFD,
49804980
SmallVector<AnyFunctionType::Param, 4> linearParams,
@@ -5007,9 +5007,9 @@ static bool checkLinearityParameters(
50075007
return false;
50085008
}
50095009

5010-
// Given a transpose function type where `self` is a linearity parameter,
5011-
// sets `staticSelfType` and `instanceSelfType` and returns true if they are
5012-
// equals. Otherwise, returns false.
5010+
/// Given a transpose function type where `self` is a linearity parameter,
5011+
/// sets `staticSelfType` and `instanceSelfType` and returns true if they are
5012+
/// equals. Otherwise, returns false.
50135013
static bool
50145014
doTransposeStaticAndInstanceSelfTypesMatch(AnyFunctionType *transposeType,
50155015
Type &staticSelfType,
@@ -5170,7 +5170,8 @@ void AttributeChecker::visitTransposeAttr(TransposeAttr *attr) {
51705170

51715171
// Diagnose if original function has opaque result types.
51725172
if (auto *opaqueResultTypeDecl = originalAFD->getOpaqueResultTypeDecl()) {
5173-
diagnose(attr->getLocation(), diag::autodiff_attr_opaque_result_type_unsupported);
5173+
diagnose(attr->getLocation(),
5174+
diag::autodiff_attr_opaque_result_type_unsupported);
51745175
attr->setInvalid();
51755176
return;
51765177
}

0 commit comments

Comments
 (0)