@@ -8,7 +8,7 @@ module CPP-TRANSLATION-DECL-DECLARATOR-SYNTAX
8
8
imports CPP-SORTS
9
9
imports CPP-TYPING-SORTS
10
10
11
- syntax Decl ::= DeclaratorAndSpecifiers(Declarator , Set)
11
+ syntax Decl ::= DeclaratorAndSpecifiers(Decl , Set)
12
12
| declareObject(NNSVal, NNSVal, CId, CId, CPPType, Init, DeclarationType, Linkage, Duration, Set)
13
13
| defineObject(NNSVal, CId, CId, CPPType, Init, DeclarationType, Set)
14
14
| initializeObject(NNSVal, CId, CPPType, init: KItem, DeclarationType) [strict(c; 4)]
@@ -53,18 +53,18 @@ module CPP-TRANSLATION-DECL-DECLARATOR
53
53
imports CPP-TRANSLATION-CONSTANT-SYNTAX
54
54
imports CPP-TRANSLATION-DECL-CLASS-DESTRUCTOR
55
55
56
- rule FunctionDecl(N::NNSVal , X::CId, Mangled::CId, T::CPPType , Params::List)
56
+ rule FunctionDecl(N::NNS , X::CId, Mangled::CId, T::AType , Params::List)
57
57
=> NormalizedDecl(N, X, Mangled, T, NoInit(), Function(Params)) [anywhere]
58
58
59
- rule VarDecl(N::NNSVal , X::CId, Mangled::CId, T::CPPType , Init::Init, IsDirect:Bool)
59
+ rule VarDecl(N::NNS , X::CId, Mangled::CId, T::AType , Init::Init, IsDirect:Bool)
60
60
=> NormalizedDecl(N, X, Mangled, T, Init, Var(#if IsDirect #then DirectInit() #else CopyInit() #fi)) [anywhere]
61
61
62
- rule FunctionDefinition(N::NNSVal , X::CId, Mangled::CId, T::CPPType , Params::List, Body::Stmt)
62
+ rule FunctionDefinition(N::NNS , X::CId, Mangled::CId, T::AType , Params::List, Body::Stmt)
63
63
=> NormalizedDecl(N, X, Mangled, T, Body, Function(Params)) [anywhere]
64
64
65
65
rule DeclStmt(L::List) => listToK(L)
66
66
67
- rule Specifier(S::Specifier, D:Declarator ) => DeclaratorAndSpecifiers(D, SetItem(S))
67
+ rule Specifier(S::Specifier, D::Decl ) => DeclaratorAndSpecifiers(D, SetItem(S))
68
68
requires S =/=K Auto() [anywhere]
69
69
70
70
// Auto is a type specifier in C++ so it is handled elsewhere by AutoType
@@ -151,8 +151,6 @@ module CPP-TRANSLATION-DECL-DECLARATOR
151
151
rule getClassLinkage(_:LocalQualifier :: _) => NoLinkage
152
152
153
153
// @ref n4296 3.5:4
154
- rule getNamespaceLinkage(N:UnnamedNamespace) => InternalLinkage
155
-
156
154
rule getNamespaceLinkage(GlobalNamespace()) => ExternalLinkage
157
155
158
156
rule getNamespaceLinkage(Parent::Namespace :: _) => getNamespaceLinkage(Parent) [owise]
@@ -418,7 +416,7 @@ module CPP-TRANSLATION-DECL-DECLARATOR
418
416
419
417
syntax CPPType ::= completeDeclaration(CPPType, Init) [function]
420
418
421
- rule completeDeclaration(T::CPPType, (ExprLoc (_, I::Init) => I))
419
+ rule completeDeclaration(T::CPPType, (InitLoc (_, I::Init) => I))
422
420
423
421
// @ref n4296 8.5.4:3.2 (char x[] = {"foo"})
424
422
rule completeDeclaration(t(Q::Quals, Mods::Set, incompleteArrayType(t(Q'::Quals, Mods'::Set, T:CPPSimpleCharType))), BraceInit(ListItem(StringLiteral(Narrow::CharKind, S::String)))) => t(Q, Mods, arrayType(t(Q', Mods', T), lengthString(S) +Int 1))
@@ -790,9 +788,12 @@ module CPP-TRANSLATION-DECL-DECLARATOR
790
788
rule stripInitHolds(V::Val) => V
791
789
requires isEvalVal(V)
792
790
793
- context defArgs(_, (HOLE:StrictList => types(HOLE)), _)
791
+ context defArgs(_, (HOLE::StrictList => types(HOLE)), _)
792
+
793
+ context defArgs(_, _, (HOLE::StrictList => cats(HOLE)))
794
794
795
- context defArgs(_, _, (HOLE:StrictList => cats(HOLE)))
795
+ rule defArgs(A:StrictListResult, B:StrictListResult, C:StrictListResult)
796
+ => defArgsResult(A, B, C)
796
797
797
798
syntax DefaultArguments ::= computeDefaultArgs(CPPType, DeclarationType)
798
799
@@ -841,7 +842,7 @@ module CPP-TRANSLATION-DECL-DECLARATOR
841
842
rule #makeFunctionDeclarationType(_, .List) => .List
842
843
843
844
rule emptyDefaultArguments(t(... st: functionType(...)) #as T::CPPType)
844
- => #emptyDefaultArguments(#if hasImplicitParameter(T) #then size(getRealParams(T)) -Int 1 #else size(getRealParams(T)) #fi, defArgs (krlist(.List), krlist(.List), krlist(.List)))
845
+ => #emptyDefaultArguments(#if hasImplicitParameter(T) #then size(getRealParams(T)) -Int 1 #else size(getRealParams(T)) #fi, defArgsResult (krlist(.List), krlist(.List), krlist(.List)))
845
846
846
847
rule emptyDefaultArguments(_) => NoDefArgs() [owise]
847
848
@@ -850,7 +851,7 @@ module CPP-TRANSLATION-DECL-DECLARATOR
850
851
rule #emptyDefaultArguments(0, DA::DefaultArgumentsResult) => DA
851
852
852
853
rule #emptyDefaultArguments(N::Int => N -Int 1,
853
- defArgs (krlist(_::List (.List => ListItem(NoArg()))),
854
+ defArgsResult (krlist(_::List (.List => ListItem(NoArg()))),
854
855
krlist(_::List (.List => ListItem(NoInitType()))),
855
856
krlist(_::List (.List => ListItem(NoInitCat()))))) [owise]
856
857
endmodule
0 commit comments