@@ -31,8 +31,9 @@ var Preprocessors = []Mapping{
31
31
32
32
func mapIASTNameDerived (typ string ) Mapping {
33
33
return MapSemantic (typ , uast.Identifier {}, MapObj (
34
- Obj {
35
- "Name" : Var ("name" ),
34
+ Fields {
35
+ {Name : "Name" , Op : Var ("name" )},
36
+ {Name : "ExpandedFromMacro" , Drop : true , Op : Any ()},
36
37
},
37
38
Obj {
38
39
"Name" : Var ("name" ),
@@ -131,10 +132,17 @@ var Normalizers = []Mapping{
131
132
{
132
133
"Name" : Var ("path" ),
133
134
"IsSystem" : Bool (true ),
135
+ // Always empty on current tests, this should detect other cases
136
+ "Path" : String ("" ),
137
+ // FIXME(juanjux): save this once we've a way
138
+ "Resolved" : Any (),
134
139
},
135
140
{
136
141
"Name" : StringConv (Var ("path" ), prependDotSlash , removeDotSlash ),
137
142
"IsSystem" : Bool (false ),
143
+ "Path" : String ("" ),
144
+ // FIXME(juanjux): save this once we've a way
145
+ "Resolved" : Any (),
138
146
},
139
147
}),
140
148
Obj {
@@ -148,8 +156,13 @@ var Normalizers = []Mapping{
148
156
)),
149
157
150
158
MapSemantic ("CPPASTCompoundStatement" , uast.Block {}, MapObj (
151
- Obj {
152
- "Prop_Statements" : Var ("statements" ),
159
+ Fields {
160
+ {Name : "Prop_Statements" , Op : Var ("statements" )},
161
+ // FIXME(juanjux): save all these once we have a way.
162
+ {Name : "ExpandedFromMacro" , Drop : true , Op : Any ()},
163
+ {Name : "LeadingComments" , Drop : true , Op : Any ()},
164
+ {Name : "FreestadingComments" , Drop : true , Op : Any ()},
165
+ {Name : "TrailingComments" , Drop : true , Op : Any ()},
153
166
},
154
167
Obj {
155
168
"Statements" : Var ("statements" ),
@@ -158,14 +171,23 @@ var Normalizers = []Mapping{
158
171
159
172
// Empty {}
160
173
MapSemantic ("CPPASTCompoundStatement" , uast.Block {}, MapObj (
161
- Obj {},
174
+ Fields {
175
+ // FIXME(juanjux): save all these once we have a way
176
+ {Name : "LeadingComments" , Drop : true , Op : Any ()},
177
+ {Name : "FreestadingComments" , Drop : true , Op : Any ()},
178
+ {Name : "TrailingComments" , Drop : true , Op : Any ()},
179
+ },
162
180
Obj {"Statements" : Arr ()},
163
181
)),
164
182
165
183
MapSemantic ("CPPASTLiteralExpression" , uast.String {}, MapObj (
166
184
Obj {
167
- "LiteralValue" : Quote (Var ("val" )),
168
- "kind" : String ("string_literal" ),
185
+ "LiteralValue" : Quote (Var ("val" )),
186
+ "kind" : String ("string_literal" ),
187
+ "ExpressionValueCategory" : String ("LVALUE" ),
188
+ "IsLValue" : Bool (true ),
189
+ // Will be const char[somenum]
190
+ "ExpressionType" : Any (),
169
191
},
170
192
Obj {
171
193
"Value" : Var ("val" ),
@@ -190,10 +212,13 @@ var Normalizers = []Mapping{
190
212
)),
191
213
192
214
// Args in C can have type but be empty (typically in headers, but also in implementations): int main(int, char**)
193
- Map (Obj {
194
- "IASTClass" : String ("CPPASTName" ),
195
- "Name" : String ("" ),
196
- },
215
+ Map (
216
+ Fields {
217
+ {Name : "IASTClass" , Op : String ("CPPASTName" )},
218
+ {Name : "Name" , Op : String ("" )},
219
+ // FIXME(juanjux): save this once we have a way.
220
+ {Name : "ExpandedFromMacro" , Drop : true , Op : Any ()},
221
+ },
197
222
Is (nil ),
198
223
),
199
224
@@ -248,8 +273,14 @@ var Normalizers = []Mapping{
248
273
},
249
274
Is (nil ),
250
275
))},
276
+ {Name : "IsConversionOperator" , Op : Bool (false )},
251
277
// Ignored: already on AllSegments
252
- {Name : "Prop_Qualifier" , Optional : "optPropQual" , Op : Any ()},
278
+ {Name : "Prop_Qualifier" , Drop : true , Op : Any ()},
279
+ // FIXME(juanjux): save these two once we've a way
280
+ {Name : "ExpandedFromMacro" , Drop : true , Op : Any ()},
281
+ {Name : "IsFullyQualified" , Op : Any ()},
282
+ // Same as Prop_AllSegments but in a single string ("foo::bar::baz") instead of a list
283
+ {Name : "Name" , Op : Any ()},
253
284
},
254
285
Obj {
255
286
"Names" : Each ("qualParts" , Cases ("caseQualParts" ,
@@ -271,55 +302,60 @@ var Normalizers = []Mapping{
271
302
Fields {
272
303
{Name : "IsDefaulted" , Op : Any ()},
273
304
{Name : "IsDeleted" , Op : Any ()},
274
- {Name : "ExpandedFromMacro" , Optional : "optMacro1" , Op : Any ()},
305
+ // FIXME(juanjux): save this once we've a way
306
+ {Name : "ExpandedFromMacro" , Drop : true , Op : Any ()},
275
307
{Name : "Prop_Body" , Optional : "optBody" , Op : Var ("body" )},
308
+ {Name : "LeadingComments" , Optional : "optLeadingComments" , Op : Var ("leadingComments" )},
309
+ {Name : "FreestadingComments" , Optional : "optFSComments" , Op : Var ("fsComments" )},
310
+ {Name : "TrailingComments" , Optional : "optTlComments" , Op : Var ("tsComments" )},
311
+ {Name : "Prop_MemberInitializers" , Optional : "optMemberInitializers" , Op : Var ("memberInitializers" )},
276
312
277
313
{Name : "Prop_DeclSpecifier" , Op : Cases ("retTypeCase" ,
278
314
Fields {
279
315
{Name : uast .KeyType , Op : String ("CPPASTSimpleDeclSpecifier" )},
280
316
{Name : uast .KeyPos , Op : Any ()},
281
- {Name : "IsComplex" , Op : Any ()},
282
- {Name : "IsConst" , Op : Any ()},
283
- {Name : "IsConstExpr" , Op : Any ()},
284
- {Name : "IsExplicit" , Op : Any ()},
285
- {Name : "IsFriend" , Op : Any ()},
286
- {Name : "IsImaginary" , Op : Any ()},
287
- {Name : "IsInline" , Op : Any ()},
288
- {Name : "IsLong" , Op : Any ()},
289
- {Name : "IsLongLong" , Op : Any ()},
290
- {Name : "IsRestrict" , Op : Any ()},
291
- {Name : "IsShort" , Op : Any ()},
292
- {Name : "IsSigned" , Op : Any ()},
293
- {Name : "IsThreadLocal" , Op : Any ()},
294
- {Name : "IsUnsigned" , Op : Any ()},
295
- {Name : "IsVirtual" , Op : Any ()},
296
- {Name : "IsVolatile" , Op : Any ()},
297
- {Name : "StorageClass" , Op : Any ()},
298
- {Name : "ExpandedFromMacro" , Optional : "optMacro2" , Op : Any ()},
317
+ {Name : "IsComplex" , Drop : true , Op : Any ()},
318
+ {Name : "IsConst" , Drop : true , Op : Any ()},
319
+ {Name : "IsConstExpr" , Drop : true , Op : Any ()},
320
+ {Name : "IsExplicit" , Drop : true , Op : Any ()},
321
+ {Name : "IsFriend" , Drop : true , Op : Any ()},
322
+ {Name : "IsImaginary" , Drop : true , Op : Any ()},
323
+ {Name : "IsInline" , Drop : true , Op : Any ()},
324
+ {Name : "IsLong" , Drop : true , Op : Any ()},
325
+ {Name : "IsLongLong" , Drop : true , Op : Any ()},
326
+ {Name : "IsRestrict" , Drop : true , Op : Any ()},
327
+ {Name : "IsShort" , Drop : true , Op : Any ()},
328
+ {Name : "IsSigned" , Drop : true , Op : Any ()},
329
+ {Name : "IsThreadLocal" , Drop : true , Op : Any ()},
330
+ {Name : "IsUnsigned" , Drop : true , Op : Any ()},
331
+ {Name : "IsVirtual" , Drop : true , Op : Any ()},
332
+ {Name : "IsVolatile" , Drop : true , Op : Any ()},
333
+ {Name : "StorageClass" , Drop : true , Op : Any ()},
334
+ {Name : "ExpandedFromMacro" , Drop : true , Op : Any ()},
299
335
{Name : "Type" , Op : String ("void" )},
300
336
},
301
337
// unspecified (ie constructor/destructors)
302
338
Fields {
303
339
{Name : uast .KeyType , Op : String ("CPPASTSimpleDeclSpecifier" )},
304
- {Name : uast .KeyPos , Op : Any ()},
305
- {Name : "IsComplex" , Op : Any ()},
306
- {Name : "IsConst" , Op : Any ()},
307
- {Name : "IsConstExpr" , Op : Any ()},
308
- {Name : "IsExplicit" , Op : Any ()},
309
- {Name : "IsFriend" , Op : Any ()},
310
- {Name : "IsImaginary" , Op : Any ()},
311
- {Name : "IsInline" , Op : Any ()},
312
- {Name : "IsLong" , Op : Any ()},
313
- {Name : "IsLongLong" , Op : Any ()},
314
- {Name : "IsRestrict" , Op : Any ()},
315
- {Name : "IsShort" , Op : Any ()},
316
- {Name : "IsSigned" , Op : Any ()},
317
- {Name : "IsThreadLocal" , Op : Any ()},
318
- {Name : "IsUnsigned" , Op : Any ()},
319
- {Name : "IsVirtual" , Op : Any ()},
320
- {Name : "IsVolatile" , Op : Any ()},
321
- {Name : "StorageClass" , Op : Any ()},
322
- {Name : "ExpandedFromMacro" , Optional : "optMacro3" , Op : Any ()},
340
+ {Name : uast .KeyPos , Drop : true , Op : Any ()},
341
+ {Name : "IsComplex" , Drop : true , Op : Any ()},
342
+ {Name : "IsConst" , Drop : true , Op : Any ()},
343
+ {Name : "IsConstExpr" , Drop : true , Op : Any ()},
344
+ {Name : "IsExplicit" , Drop : true , Op : Any ()},
345
+ {Name : "IsFriend" , Drop : true , Op : Any ()},
346
+ {Name : "IsImaginary" , Drop : true , Op : Any ()},
347
+ {Name : "IsInline" , Drop : true , Op : Any ()},
348
+ {Name : "IsLong" , Drop : true , Op : Any ()},
349
+ {Name : "IsLongLong" , Drop : true , Op : Any ()},
350
+ {Name : "IsRestrict" , Drop : true , Op : Any ()},
351
+ {Name : "IsShort" , Drop : true , Op : Any ()},
352
+ {Name : "IsSigned" , Drop : true , Op : Any ()},
353
+ {Name : "IsThreadLocal" , Drop : true , Op : Any ()},
354
+ {Name : "IsUnsigned" , Drop : true , Op : Any ()},
355
+ {Name : "IsVirtual" , Drop : true , Op : Any ()},
356
+ {Name : "IsVolatile" , Drop : true , Op : Any ()},
357
+ {Name : "StorageClass" , Drop : true , Op : Any ()},
358
+ {Name : "ExpandedFromMacro" , Drop : true , Op : Any ()},
323
359
{Name : "Type" , Op : String ("unspecified" )},
324
360
},
325
361
Fields {
@@ -343,7 +379,7 @@ var Normalizers = []Mapping{
343
379
{Name : "IsVirtual" , Op : Any ()},
344
380
{Name : "IsVolatile" , Op : Any ()},
345
381
{Name : "StorageClass" , Op : Var ("StorageClass" )},
346
- {Name : "ExpandedFromMacro" , Optional : "optMacro4" , Op : Any ()},
382
+ {Name : "ExpandedFromMacro" , Drop : true , Op : Any ()},
347
383
{Name : "Type" , Op : Var ("retType" )},
348
384
},
349
385
Fields {
@@ -361,7 +397,7 @@ var Normalizers = []Mapping{
361
397
{Name : "IsTypeName" , Op : Any ()},
362
398
{Name : "IsVirtual" , Op : Any ()},
363
399
{Name : "IsVolatile" , Op : Any ()},
364
- {Name : "ExpandedFromMacro" , Optional : "optMacro5" , Op : Any ()},
400
+ {Name : "ExpandedFromMacro" , Drop : true , Op : Any ()},
365
401
{Name : "Prop_Name" , Op : Var ("retType" )},
366
402
},
367
403
)},
@@ -375,9 +411,9 @@ var Normalizers = []Mapping{
375
411
{Name : "IsOverride" , Op : Any ()},
376
412
{Name : "IsPureVirtual" , Op : Any ()},
377
413
{Name : "IsVolatile" , Op : Any ()},
378
- {Name : "ExpandedFromMacro" , Optional : "optMacro6" , Op : Any ()},
379
- {Name : "Prop_NoexceptExpression" , Optional : "declNoExcept" , Op : Any ()},
380
- {Name : "Prop_VirtSpecifiers" , Optional : "declVirtSpecs" , Op : Any ()},
414
+ {Name : "ExpandedFromMacro" , Drop : true , Op : Any ()},
415
+ {Name : "Prop_NoexceptExpression" , Drop : true , Op : Any ()},
416
+ {Name : "Prop_VirtSpecifiers" , Drop : true , Op : Any ()},
381
417
382
418
{Name : "Prop_Name" , Op : Cases ("caseName" ,
383
419
// Empty identifier
@@ -398,31 +434,33 @@ var Normalizers = []Mapping{
398
434
)},
399
435
400
436
{Name : "TakesVarArgs" , Op : Cases ("takesVarArgs" , Bool (false ), Bool (true ))},
401
- {Name : "Prop_ConstructorChain" , Optional : "optConsChain" , Op : Any ()},
402
- {Name : "Prop_PointerOperators" , Optional : "optPointerOps" , Op : Any ()},
437
+ {Name : "Prop_ConstructorChain" , Drop : true , Op : Any ()},
438
+ {Name : "Prop_PointerOperators" , Drop : true , Op : Any ()},
403
439
404
440
{Name : "Prop_Parameters" , Optional : "optArgs" , Op : Each ("args" , Cases ("caseParams" ,
405
441
Fields {
406
442
{Name : uast .KeyType , Op : String ("CPPASTDeclarator" )},
407
443
{Name : uast .KeyPos , Op : Var ("parampos" )},
408
444
{Name : "Prop_Name" , Op : Var ("aname" )},
409
445
{Name : "Prop_TypeNode" , Op : Var ("atype" )},
410
- {Name : "DeclaresParameterPack" , Op : Any ()},
411
- {Name : "Prop_PointerOperators" , Optional : "optPointerOps" , Op : Any ()},
412
446
{Name : "Prop_Initializer" , Optional : "optInitializer" , Op : Var ("ainit" )},
413
- {Name : "ExpandedFromMacro" , Optional : "optMacro" , Op : Any ()},
414
- {Name : "Prop_PointerOperators" , Optional : "optPointerOps" , Op : Any ()},
447
+ // FIXME(juanjux): save these once we've a way
448
+ {Name : "DeclaresParameterPack" , Drop : true , Op : Any ()},
449
+ {Name : "Prop_PointerOperators" , Drop : true , Op : Any ()},
450
+ {Name : "ExpandedFromMacro" , Drop : true , Op : Any ()},
451
+ {Name : "Prop_PointerOperators" , Drop : true , Op : Any ()},
415
452
},
416
453
Fields {
417
454
{Name : uast .KeyType , Op : String ("CPPASTArrayDeclarator" )},
418
455
{Name : uast .KeyPos , Op : Var ("parampos" )},
419
456
{Name : "Prop_Name" , Op : Var ("aname" )},
420
457
{Name : "Prop_TypeNode" , Op : Var ("atype" )},
421
- {Name : "DeclaresParameterPack" , Op : Any ()},
422
- {Name : "Prop_ArrayModifiers" , Op : Any ()},
423
458
{Name : "Prop_Initializer" , Optional : "optInitializer" , Op : Var ("ainit" )},
424
- {Name : "ExpandedFromMacro" , Optional : "optMacro" , Op : Any ()},
425
- {Name : "Prop_PointerOperators" , Optional : "optPointerOps" , Op : Any ()},
459
+ // FIXME(juanjux): save these once we've a way
460
+ {Name : "DeclaresParameterPack" , Drop : true , Op : Any ()},
461
+ {Name : "Prop_ArrayModifiers" , Drop : true , Op : Any ()},
462
+ {Name : "ExpandedFromMacro" , Drop : true , Op : Any ()},
463
+ {Name : "Prop_PointerOperators" , Drop : true , Op : Any ()},
426
464
},
427
465
Fields {
428
466
{Name : uast .KeyType , Op : String ("CPPASTElaboratedTypeSpecifier" )},
@@ -440,13 +478,22 @@ var Normalizers = []Mapping{
440
478
{Name : "IsVirtual" , Op : Any ()},
441
479
{Name : "IsVolatile" , Op : Any ()},
442
480
{Name : "StorageClass" , Op : Any ()},
443
- {Name : "ExpandedFromMacro" , Optional : "optMacro" , Op : Any ()},
481
+ // FIXME(juanjux): save these once we've a way
482
+ {Name : "ExpandedFromMacro" , Drop : true , Op : Any ()},
444
483
},
445
484
))},
446
485
}},
447
486
},
448
487
Obj {
449
488
"Nodes" : Arr (
489
+ Fields {
490
+ {Name : "Comments" , Op : Fields {
491
+ {Name : "LeadingComments" , Optional : "optLeadingComments" , Op : Var ("leadingComments" )},
492
+ {Name : "FreestadingComments" , Optional : "optFSComments" , Op : Var ("fsComments" )},
493
+ {Name : "TrailingComments" , Optional : "optTlComments" , Op : Var ("tsComments" )},
494
+ }},
495
+ {Name : "MemberInitializers" , Optional : "optMemberInitializers" , Op : Var ("memberInitializers" )},
496
+ },
450
497
UASTType (uast.Alias {}, Obj {
451
498
"Name" : UASTType (uast.Identifier {}, CasesObj ("caseName" , Obj {},
452
499
Objs {
0 commit comments