Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 2de4dfd

Browse files
author
Juanjo Alvarez
committed
Feedback from review
Signed-off-by: Juanjo Alvarez <[email protected]>
1 parent 2d711ae commit 2de4dfd

File tree

138 files changed

+27400
-1988
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+27400
-1988
lines changed

driver/normalizer/annotation.go

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ var Annotations = []Mapping{
130130
AnnotateType("internal-type", nil, role.Incomplete),
131131
AnnotateType("CPPASTTranslationUnit", nil, role.File, role.Module),
132132
AnnotateType("CPPASTExpressionStatement", nil, role.Expression),
133-
// XXX isQualified field? (for both)
134133
AnnotateType("CPPASTName", FieldRoles{"Name": {Rename: uast.KeyToken}},
135134
role.Identifier),
136135
AnnotateType("CPPASTImplicitName", FieldRoles{"Name": {Rename: uast.KeyToken}},
@@ -159,6 +158,7 @@ var Annotations = []Mapping{
159158
AnnotateType("CPPASTDeleteExpression", nil, role.Call, role.Expression, role.Incomplete),
160159
AnnotateType("CPPASTInitializerList", nil, role.Initialization, role.List),
161160
AnnotateType("CPPASTCastExpression", nil, role.Expression, role.Incomplete),
161+
AnnotateType("CPPASTDesignatedInitializer", nil, role.Expression, role.Initialization),
162162

163163
AnnotateTypeCustom("CPPASTUnaryExpression",
164164
FieldRoles{
@@ -202,7 +202,7 @@ var Annotations = []Mapping{
202202

203203
AnnotateType("CPPASTFunctionDeclarator", FieldRoles{
204204
"Prop_Name": {Roles: role.Roles{role.Function, role.Declaration, role.Name}},
205-
// SDK? FIXME: adding "Opt: true" fails since Arrays can't be optional, but without it the annotation won't
205+
// SDK TODO: adding "Opt: true" fails since Arrays can't be optional, but without it the annotation won't
206206
// match, thus the duplicated annotation below
207207
"Prop_Parameters": {Arr: true, Roles: role.Roles{role.Function, role.Declaration, role.Argument}},
208208
}, role.Function, role.Declaration),
@@ -214,12 +214,18 @@ var Annotations = []Mapping{
214214
AnnotateType("CPPASTReturnStatement", ObjRoles{
215215
"Prop_ReturnArgument": {role.Return, role.Value},
216216
}, role.Statement, role.Return),
217-
//
218-
AnnotateTypeCustom("CPPASTBinaryExpression", FieldRoles{
219-
"Operator": {Rename: uast.KeyToken, Op: Var("op")},
220-
"Prop_Operand1": {Roles: role.Roles{role.Binary, role.Expression, role.Left}},
221-
"Prop_Operand2": {Roles: role.Roles{role.Binary, role.Expression, role.Left}},
222-
}, LookupArrOpVar("op", binaryExprRoles)),
217+
218+
AnnotateTypeCustom("CPPASTBinaryExpression", MapObj(Obj{
219+
"Operator": Var("operator"),
220+
"Prop_Operand1": ObjectRoles("operand1"),
221+
"Prop_Operand2": ObjectRoles("operand2"),
222+
// Temporarily using the same name to detect if those are really duplicated
223+
"Prop_InitOperand2": ObjectRoles("operand2"),
224+
}, Obj{
225+
uast.KeyToken: Var("operator"),
226+
"Prop_Operand1": ObjectRoles("operand1", role.Binary, role.Expression, role.Left),
227+
"Prop_Operand2": ObjectRoles("operand2", role.Binary, role.Expression, role.Right),
228+
}), LookupArrOpVar("operator", binaryExprRoles)),
223229

224230
AnnotateType("CPPASTEqualsInitializer", nil, role.Declaration, role.Assignment, role.Expression, role.Right),
225231

@@ -244,6 +250,7 @@ var Annotations = []Mapping{
244250
AnnotateType("CPPASTCompositeTypeSpecifier", FieldRoles{
245251
"Key": {Op: String("union")},
246252
"Prop_Members": {Arr: true, Roles: role.Roles{role.Declaration, role.Type, role.Incomplete}},
253+
//"Prop_Clauses": {Arr: true, Roles: role.Roles{role.Declaration, role.Type, role.Incomplete}},
247254
} , role.Declaration, role.Type, role.Incomplete),
248255

249256
AnnotateType("CPPASTCompositeTypeSpecifier", FieldRoles{

fixtures/_integration.cpp.legacy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ CPPASTTranslationUnit {
231231
. . . . . . . . . . . }
232232
. . . . . . . . . . }
233233
. . . . . . . . . . 1: CPPASTLiteralExpression {
234-
. . . . . . . . . . . Roles: Expression,Literal,String,Binary,Left
234+
. . . . . . . . . . . Roles: Expression,Literal,String,Binary,Right
235235
. . . . . . . . . . . TOKEN ""Hello, World!""
236236
. . . . . . . . . . . StartPosition: {
237237
. . . . . . . . . . . . Offset: 51

fixtures/_integration.cpp.native

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@
2828
LocOffsetEnd: 66,
2929
LocOffsetStart: 38,
3030
Operator: "<<",
31+
'Prop_InitOperand2': {
32+
ExpressionType: "const char [14]",
33+
ExpressionValueCategory: "LVALUE",
34+
IASTClass: "CPPASTLiteralExpression",
35+
IsLValue: true,
36+
LiteralValue: "\"Hello, World!\"",
37+
LocOffsetEnd: 66,
38+
LocOffsetStart: 51,
39+
kind: "string_literal",
40+
},
3141
'Prop_Operand1': {
3242
ExpressionType: "org.eclipse.cdt.internal.core.dom.parser.ProblemType",
3343
ExpressionValueCategory: "PRVALUE",

fixtures/_integration.cpp.sem.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
},
170170
'Prop_Operand2': { '@type': "CPPASTLiteralExpression",
171171
'@token': "\"Hello, World!\"",
172-
'@role': [Binary, Expression, Left, Literal, String],
172+
'@role': [Binary, Expression, Literal, Right, String],
173173
'@pos': { '@type': "uast:Positions",
174174
start: { '@type': "uast:Position",
175175
offset: 51,

fixtures/_integration.cpp.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
},
170170
'Prop_Operand2': { '@type': "CPPASTLiteralExpression",
171171
'@token': "\"Hello, World!\"",
172-
'@role': [Binary, Expression, Left, Literal, String],
172+
'@role': [Binary, Expression, Literal, Right, String],
173173
'@pos': { '@type': "uast:Positions",
174174
start: { '@type': "uast:Position",
175175
offset: 51,

fixtures/anonymous_class_declaration.cpp.native

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@
2626
IASTClass: "CPPASTDeclarator",
2727
LocOffsetEnd: 18,
2828
LocOffsetStart: 9,
29+
'Prop_ImplicitNames': [
30+
{
31+
IASTClass: "CPPASTImplicitName",
32+
IsAlternate: false,
33+
IsOverloadedOperator: false,
34+
LocOffsetEnd: 18,
35+
LocOffsetStart: 9,
36+
Name: "",
37+
},
38+
],
2939
'Prop_Name': {
3040
IASTClass: "CPPASTName",
3141
LocOffsetEnd: 18,

fixtures/anonymous_class_declaration.cpp.sem.uast

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,26 @@
6666
},
6767
},
6868
DeclaresParameterPack: false,
69+
'Prop_ImplicitNames': [
70+
{ '@type': "CPPASTImplicitName",
71+
'@token': "",
72+
'@role': [Identifier],
73+
'@pos': { '@type': "uast:Positions",
74+
start: { '@type': "uast:Position",
75+
offset: 9,
76+
line: 1,
77+
col: 10,
78+
},
79+
end: { '@type': "uast:Position",
80+
offset: 18,
81+
line: 1,
82+
col: 19,
83+
},
84+
},
85+
IsAlternate: false,
86+
IsOverloadedOperator: false,
87+
},
88+
],
6989
'Prop_Name': { '@type': "CPPASTName",
7090
'@token': "instance1",
7191
'@role': [Identifier],

fixtures/anonymous_class_declaration.cpp.uast

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,26 @@
6666
},
6767
},
6868
DeclaresParameterPack: false,
69+
'Prop_ImplicitNames': [
70+
{ '@type': "CPPASTImplicitName",
71+
'@token': "",
72+
'@role': [Identifier],
73+
'@pos': { '@type': "uast:Positions",
74+
start: { '@type': "uast:Position",
75+
offset: 9,
76+
line: 1,
77+
col: 10,
78+
},
79+
end: { '@type': "uast:Position",
80+
offset: 18,
81+
line: 1,
82+
col: 19,
83+
},
84+
},
85+
IsAlternate: false,
86+
IsOverloadedOperator: false,
87+
},
88+
],
6989
'Prop_Name': { '@type': "CPPASTName",
7090
'@token': "instance1",
7191
'@role': [Identifier],

fixtures/arithmeticops.cpp.native

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@
2727
LocOffsetEnd: 18,
2828
LocOffsetStart: 15,
2929
Operator: "+",
30+
'Prop_InitOperand2': {
31+
ExpressionType: "int",
32+
ExpressionValueCategory: "PRVALUE",
33+
IASTClass: "CPPASTLiteralExpression",
34+
IsLValue: false,
35+
LiteralValue: "2",
36+
LocOffsetEnd: 18,
37+
LocOffsetStart: 17,
38+
kind: "integer_constant",
39+
},
3040
'Prop_Operand1': {
3141
ExpressionType: "int",
3242
ExpressionValueCategory: "PRVALUE",
@@ -61,6 +71,16 @@
6171
LocOffsetEnd: 25,
6272
LocOffsetStart: 22,
6373
Operator: "-",
74+
'Prop_InitOperand2': {
75+
ExpressionType: "int",
76+
ExpressionValueCategory: "PRVALUE",
77+
IASTClass: "CPPASTLiteralExpression",
78+
IsLValue: false,
79+
LiteralValue: "2",
80+
LocOffsetEnd: 25,
81+
LocOffsetStart: 24,
82+
kind: "integer_constant",
83+
},
6484
'Prop_Operand1': {
6585
ExpressionType: "int",
6686
ExpressionValueCategory: "PRVALUE",
@@ -95,6 +115,16 @@
95115
LocOffsetEnd: 32,
96116
LocOffsetStart: 29,
97117
Operator: "*",
118+
'Prop_InitOperand2': {
119+
ExpressionType: "int",
120+
ExpressionValueCategory: "PRVALUE",
121+
IASTClass: "CPPASTLiteralExpression",
122+
IsLValue: false,
123+
LiteralValue: "2",
124+
LocOffsetEnd: 32,
125+
LocOffsetStart: 31,
126+
kind: "integer_constant",
127+
},
98128
'Prop_Operand1': {
99129
ExpressionType: "int",
100130
ExpressionValueCategory: "PRVALUE",
@@ -129,6 +159,16 @@
129159
LocOffsetEnd: 39,
130160
LocOffsetStart: 36,
131161
Operator: "/",
162+
'Prop_InitOperand2': {
163+
ExpressionType: "int",
164+
ExpressionValueCategory: "PRVALUE",
165+
IASTClass: "CPPASTLiteralExpression",
166+
IsLValue: false,
167+
LiteralValue: "2",
168+
LocOffsetEnd: 39,
169+
LocOffsetStart: 38,
170+
kind: "integer_constant",
171+
},
132172
'Prop_Operand1': {
133173
ExpressionType: "int",
134174
ExpressionValueCategory: "PRVALUE",
@@ -163,6 +203,16 @@
163203
LocOffsetEnd: 46,
164204
LocOffsetStart: 43,
165205
Operator: "%",
206+
'Prop_InitOperand2': {
207+
ExpressionType: "int",
208+
ExpressionValueCategory: "PRVALUE",
209+
IASTClass: "CPPASTLiteralExpression",
210+
IsLValue: false,
211+
LiteralValue: "2",
212+
LocOffsetEnd: 46,
213+
LocOffsetStart: 45,
214+
kind: "integer_constant",
215+
},
166216
'Prop_Operand1': {
167217
ExpressionType: "int",
168218
ExpressionValueCategory: "PRVALUE",
@@ -220,6 +270,16 @@
220270
LocOffsetStart: 58,
221271
kind: "integer_constant",
222272
},
273+
'Prop_InitializerClause': {
274+
ExpressionType: "int",
275+
ExpressionValueCategory: "PRVALUE",
276+
IASTClass: "CPPASTLiteralExpression",
277+
IsLValue: false,
278+
LiteralValue: "1",
279+
LocOffsetEnd: 59,
280+
LocOffsetStart: 58,
281+
kind: "integer_constant",
282+
},
223283
},
224284
'Prop_Name': {
225285
IASTClass: "CPPASTName",
@@ -355,6 +415,16 @@
355415
LocOffsetEnd: 95,
356416
LocOffsetStart: 91,
357417
Operator: "+=",
418+
'Prop_InitOperand2': {
419+
ExpressionType: "int",
420+
ExpressionValueCategory: "PRVALUE",
421+
IASTClass: "CPPASTLiteralExpression",
422+
IsLValue: false,
423+
LiteralValue: "1",
424+
LocOffsetEnd: 95,
425+
LocOffsetStart: 94,
426+
kind: "integer_constant",
427+
},
358428
'Prop_Operand1': {
359429
ExpressionType: "int",
360430
ExpressionValueCategory: "LVALUE",
@@ -393,6 +463,16 @@
393463
LocOffsetEnd: 103,
394464
LocOffsetStart: 99,
395465
Operator: "-=",
466+
'Prop_InitOperand2': {
467+
ExpressionType: "int",
468+
ExpressionValueCategory: "PRVALUE",
469+
IASTClass: "CPPASTLiteralExpression",
470+
IsLValue: false,
471+
LiteralValue: "1",
472+
LocOffsetEnd: 103,
473+
LocOffsetStart: 102,
474+
kind: "integer_constant",
475+
},
396476
'Prop_Operand1': {
397477
ExpressionType: "int",
398478
ExpressionValueCategory: "LVALUE",
@@ -431,6 +511,16 @@
431511
LocOffsetEnd: 111,
432512
LocOffsetStart: 107,
433513
Operator: "/=",
514+
'Prop_InitOperand2': {
515+
ExpressionType: "int",
516+
ExpressionValueCategory: "PRVALUE",
517+
IASTClass: "CPPASTLiteralExpression",
518+
IsLValue: false,
519+
LiteralValue: "2",
520+
LocOffsetEnd: 111,
521+
LocOffsetStart: 110,
522+
kind: "integer_constant",
523+
},
434524
'Prop_Operand1': {
435525
ExpressionType: "int",
436526
ExpressionValueCategory: "LVALUE",
@@ -469,6 +559,16 @@
469559
LocOffsetEnd: 119,
470560
LocOffsetStart: 115,
471561
Operator: "*=",
562+
'Prop_InitOperand2': {
563+
ExpressionType: "int",
564+
ExpressionValueCategory: "PRVALUE",
565+
IASTClass: "CPPASTLiteralExpression",
566+
IsLValue: false,
567+
LiteralValue: "3",
568+
LocOffsetEnd: 119,
569+
LocOffsetStart: 118,
570+
kind: "integer_constant",
571+
},
472572
'Prop_Operand1': {
473573
ExpressionType: "int",
474574
ExpressionValueCategory: "LVALUE",
@@ -507,6 +607,16 @@
507607
LocOffsetEnd: 127,
508608
LocOffsetStart: 123,
509609
Operator: "%=",
610+
'Prop_InitOperand2': {
611+
ExpressionType: "int",
612+
ExpressionValueCategory: "PRVALUE",
613+
IASTClass: "CPPASTLiteralExpression",
614+
IsLValue: false,
615+
LiteralValue: "4",
616+
LocOffsetEnd: 127,
617+
LocOffsetStart: 126,
618+
kind: "integer_constant",
619+
},
510620
'Prop_Operand1': {
511621
ExpressionType: "int",
512622
ExpressionValueCategory: "LVALUE",

0 commit comments

Comments
 (0)