1 //===-- FeatureList.cpp ---------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // A plugin that counts the amount of times a particular parse tree node
10 // occurs. This plugin should cover each feature covered in dump-parse-tree.h
12 //===----------------------------------------------------------------------===//
14 #include "flang/Frontend/FrontendActions.h"
15 #include "flang/Frontend/FrontendPluginRegistry.h"
16 #include "flang/Parser/parse-tree-visitor.h"
17 #include "flang/Parser/parse-tree.h"
18 #include "flang/Parser/parsing.h"
22 #include <unordered_map>
26 using namespace Fortran::common
;
27 using namespace Fortran::frontend
;
28 using namespace Fortran::parser
;
29 using namespace Fortran
;
31 #define READ_FEATURE_CUST(classname, n) \
32 bool Pre(const classname &) { \
36 void Post(const classname &) {}
38 #define READ_FEATURE(classname) READ_FEATURE_CUST(classname, classname)
42 std::unordered_map
<const char *, unsigned int> frequencies
;
44 void record(const char *name
) {
45 auto [it
, ins
] = frequencies
.insert({name
, 1});
52 const std::unordered_map
<const char *, unsigned int> &getFrequencies() const {
56 READ_FEATURE_CUST(format::ControlEditDesc
, ControlEditDesc
)
57 READ_FEATURE_CUST(format::DerivedTypeDataEditDesc
, DerivedTypeDataEditDesc
)
58 READ_FEATURE_CUST(format::FormatItem
, FormatItem
)
59 READ_FEATURE_CUST(format::FormatSpecification
, FormatSpecification
)
61 format::IntrinsicTypeDataEditDesc
, IntrinsicTypeDataEditDesc
)
62 READ_FEATURE(Abstract
)
63 READ_FEATURE(AccAtomicCapture
)
64 READ_FEATURE(AccAtomicCapture::Stmt1
)
65 READ_FEATURE(AccAtomicCapture::Stmt2
)
66 READ_FEATURE(AccAtomicRead
)
67 READ_FEATURE(AccAtomicUpdate
)
68 READ_FEATURE(AccAtomicWrite
)
69 READ_FEATURE(AccBeginBlockDirective
)
70 READ_FEATURE(AccBeginCombinedDirective
)
71 READ_FEATURE(AccBeginLoopDirective
)
72 READ_FEATURE(AccBlockDirective
)
73 READ_FEATURE(AccClause
)
74 READ_FEATURE(AccBindClause
)
75 READ_FEATURE(AccDefaultClause
)
76 READ_FEATURE(AccClauseList
)
77 READ_FEATURE(AccCombinedDirective
)
78 READ_FEATURE(AccDataModifier
)
79 READ_FEATURE(AccDataModifier::Modifier
)
80 READ_FEATURE(AccDeclarativeDirective
)
81 READ_FEATURE(AccEndAtomic
)
82 READ_FEATURE(AccEndBlockDirective
)
83 READ_FEATURE(AccEndCombinedDirective
)
84 READ_FEATURE(AccGangArg
)
85 READ_FEATURE(AccObject
)
86 READ_FEATURE(AccObjectList
)
87 READ_FEATURE(AccObjectListWithModifier
)
88 READ_FEATURE(AccObjectListWithReduction
)
89 READ_FEATURE(AccReductionOperator
)
90 READ_FEATURE(AccReductionOperator::Operator
)
91 READ_FEATURE(AccSizeExpr
)
92 READ_FEATURE(AccSizeExprList
)
93 READ_FEATURE(AccSelfClause
)
94 READ_FEATURE(AccStandaloneDirective
)
95 READ_FEATURE(AccDeviceTypeExpr
)
96 READ_FEATURE(AccDeviceTypeExprList
)
97 READ_FEATURE(AccTileExpr
)
98 READ_FEATURE(AccTileExprList
)
99 READ_FEATURE(AccLoopDirective
)
100 READ_FEATURE(AccWaitArgument
)
101 READ_FEATURE(AcImpliedDo
)
102 READ_FEATURE(AcImpliedDoControl
)
103 READ_FEATURE(AcValue
)
104 READ_FEATURE(AccessStmt
)
105 READ_FEATURE(AccessId
)
106 READ_FEATURE(AccessSpec
)
107 READ_FEATURE(AccessSpec::Kind
)
109 READ_FEATURE(ActionStmt
)
110 READ_FEATURE(ActualArg
)
111 READ_FEATURE(ActualArg::PercentRef
)
112 READ_FEATURE(ActualArg::PercentVal
)
113 READ_FEATURE(ActualArgSpec
)
114 READ_FEATURE(AcValue::Triplet
)
115 READ_FEATURE(AllocOpt
)
116 READ_FEATURE(AllocOpt::Mold
)
117 READ_FEATURE(AllocOpt::Source
)
118 READ_FEATURE(Allocatable
)
119 READ_FEATURE(AllocatableStmt
)
120 READ_FEATURE(AllocateCoarraySpec
)
121 READ_FEATURE(AllocateObject
)
122 READ_FEATURE(AllocateShapeSpec
)
123 READ_FEATURE(AllocateStmt
)
124 READ_FEATURE(Allocation
)
125 READ_FEATURE(AltReturnSpec
)
126 READ_FEATURE(ArithmeticIfStmt
)
127 READ_FEATURE(ArrayConstructor
)
128 READ_FEATURE(ArrayElement
)
129 READ_FEATURE(ArraySpec
)
130 READ_FEATURE(AssignStmt
)
131 READ_FEATURE(AssignedGotoStmt
)
132 READ_FEATURE(AssignmentStmt
)
133 READ_FEATURE(AssociateConstruct
)
134 READ_FEATURE(AssociateStmt
)
135 READ_FEATURE(Association
)
136 READ_FEATURE(AssumedImpliedSpec
)
137 READ_FEATURE(AssumedRankSpec
)
138 READ_FEATURE(AssumedShapeSpec
)
139 READ_FEATURE(AssumedSizeSpec
)
140 READ_FEATURE(Asynchronous
)
141 READ_FEATURE(AsynchronousStmt
)
142 READ_FEATURE(AttrSpec
)
143 READ_FEATURE(BOZLiteralConstant
)
144 READ_FEATURE(BackspaceStmt
)
145 READ_FEATURE(BasedPointer
)
146 READ_FEATURE(BasedPointerStmt
)
147 READ_FEATURE(BindAttr
)
148 READ_FEATURE(BindAttr::Deferred
)
149 READ_FEATURE(BindAttr::Non_Overridable
)
150 READ_FEATURE(BindEntity
)
151 READ_FEATURE(BindEntity::Kind
)
152 READ_FEATURE(BindStmt
)
154 READ_FEATURE(BlockConstruct
)
155 READ_FEATURE(BlockData
)
156 READ_FEATURE(BlockDataStmt
)
157 READ_FEATURE(BlockSpecificationPart
)
158 READ_FEATURE(BlockStmt
)
159 READ_FEATURE(BoundsRemapping
)
160 READ_FEATURE(BoundsSpec
)
162 READ_FEATURE(CallStmt
)
163 READ_FEATURE(CaseConstruct
)
164 READ_FEATURE(CaseConstruct::Case
)
165 READ_FEATURE(CaseSelector
)
166 READ_FEATURE(CaseStmt
)
167 READ_FEATURE(CaseValueRange
)
168 READ_FEATURE(CaseValueRange::Range
)
169 READ_FEATURE(ChangeTeamConstruct
)
170 READ_FEATURE(ChangeTeamStmt
)
171 READ_FEATURE(CharLength
)
172 READ_FEATURE(CharLiteralConstant
)
173 READ_FEATURE(CharLiteralConstantSubstring
)
174 READ_FEATURE(CharSelector
)
175 READ_FEATURE(CharSelector::LengthAndKind
)
176 READ_FEATURE(CloseStmt
)
177 READ_FEATURE(CloseStmt::CloseSpec
)
178 READ_FEATURE(CoarrayAssociation
)
179 READ_FEATURE(CoarraySpec
)
180 READ_FEATURE(CodimensionDecl
)
181 READ_FEATURE(CodimensionStmt
)
182 READ_FEATURE(CoindexedNamedObject
)
183 READ_FEATURE(CommonBlockObject
)
184 READ_FEATURE(CommonStmt
)
185 READ_FEATURE(CommonStmt::Block
)
186 READ_FEATURE(CompilerDirective
)
187 READ_FEATURE(CompilerDirective::IgnoreTKR
)
188 READ_FEATURE(CompilerDirective::LoopCount
)
189 READ_FEATURE(CompilerDirective::NameValue
)
190 READ_FEATURE(ComplexLiteralConstant
)
191 READ_FEATURE(ComplexPart
)
192 READ_FEATURE(ComponentArraySpec
)
193 READ_FEATURE(ComponentAttrSpec
)
194 READ_FEATURE(ComponentDataSource
)
195 READ_FEATURE(ComponentDecl
)
196 READ_FEATURE(FillDecl
)
197 READ_FEATURE(ComponentOrFill
)
198 READ_FEATURE(ComponentDefStmt
)
199 READ_FEATURE(ComponentSpec
)
200 READ_FEATURE(ComputedGotoStmt
)
201 READ_FEATURE(ConcurrentControl
)
202 READ_FEATURE(ConcurrentHeader
)
203 READ_FEATURE(ConnectSpec
)
204 READ_FEATURE(ConnectSpec::CharExpr
)
205 READ_FEATURE(ConnectSpec::CharExpr::Kind
)
206 READ_FEATURE(ConnectSpec::Newunit
)
207 READ_FEATURE(ConnectSpec::Recl
)
208 READ_FEATURE(ContainsStmt
)
209 READ_FEATURE(Contiguous
)
210 READ_FEATURE(ContiguousStmt
)
211 READ_FEATURE(ContinueStmt
)
212 READ_FEATURE(CriticalConstruct
)
213 READ_FEATURE(CriticalStmt
)
214 READ_FEATURE(CycleStmt
)
215 READ_FEATURE(DataComponentDefStmt
)
216 READ_FEATURE(DataIDoObject
)
217 READ_FEATURE(DataImpliedDo
)
218 READ_FEATURE(DataRef
)
219 READ_FEATURE(DataStmt
)
220 READ_FEATURE(DataStmtConstant
)
221 READ_FEATURE(DataStmtObject
)
222 READ_FEATURE(DataStmtRepeat
)
223 READ_FEATURE(DataStmtSet
)
224 READ_FEATURE(DataStmtValue
)
225 READ_FEATURE(DeallocateStmt
)
226 READ_FEATURE(DeclarationConstruct
)
227 READ_FEATURE(DeclarationTypeSpec
)
228 READ_FEATURE(DeclarationTypeSpec::Class
)
229 READ_FEATURE(DeclarationTypeSpec::ClassStar
)
230 READ_FEATURE(DeclarationTypeSpec::Record
)
231 READ_FEATURE(DeclarationTypeSpec::Type
)
232 READ_FEATURE(DeclarationTypeSpec::TypeStar
)
233 READ_FEATURE(Default
)
234 READ_FEATURE(DeferredCoshapeSpecList
)
235 READ_FEATURE(DeferredShapeSpecList
)
236 READ_FEATURE(DefinedOpName
)
237 READ_FEATURE(DefinedOperator
)
238 READ_FEATURE(DefinedOperator::IntrinsicOperator
)
239 READ_FEATURE(DerivedTypeDef
)
240 READ_FEATURE(DerivedTypeSpec
)
241 READ_FEATURE(DerivedTypeStmt
)
242 READ_FEATURE(Designator
)
243 READ_FEATURE(DimensionStmt
)
244 READ_FEATURE(DimensionStmt::Declaration
)
245 READ_FEATURE(DoConstruct
)
246 READ_FEATURE(DummyArg
)
247 READ_FEATURE(ElseIfStmt
)
248 READ_FEATURE(ElseStmt
)
249 READ_FEATURE(ElsewhereStmt
)
250 READ_FEATURE(EndAssociateStmt
)
251 READ_FEATURE(EndBlockDataStmt
)
252 READ_FEATURE(EndBlockStmt
)
253 READ_FEATURE(EndChangeTeamStmt
)
254 READ_FEATURE(EndCriticalStmt
)
255 READ_FEATURE(EndDoStmt
)
256 READ_FEATURE(EndEnumStmt
)
257 READ_FEATURE(EndForallStmt
)
258 READ_FEATURE(EndFunctionStmt
)
259 READ_FEATURE(EndIfStmt
)
260 READ_FEATURE(EndInterfaceStmt
)
261 READ_FEATURE(EndLabel
)
262 READ_FEATURE(EndModuleStmt
)
263 READ_FEATURE(EndMpSubprogramStmt
)
264 READ_FEATURE(EndProgramStmt
)
265 READ_FEATURE(EndSelectStmt
)
266 READ_FEATURE(EndSubmoduleStmt
)
267 READ_FEATURE(EndSubroutineStmt
)
268 READ_FEATURE(EndTypeStmt
)
269 READ_FEATURE(EndWhereStmt
)
270 READ_FEATURE(EndfileStmt
)
271 READ_FEATURE(EntityDecl
)
272 READ_FEATURE(EntryStmt
)
273 READ_FEATURE(EnumDef
)
274 READ_FEATURE(EnumDefStmt
)
275 READ_FEATURE(Enumerator
)
276 READ_FEATURE(EnumeratorDefStmt
)
277 READ_FEATURE(EorLabel
)
278 READ_FEATURE(EquivalenceObject
)
279 READ_FEATURE(EquivalenceStmt
)
280 READ_FEATURE(ErrLabel
)
281 READ_FEATURE(ErrorRecovery
)
282 READ_FEATURE(EventPostStmt
)
283 READ_FEATURE(EventWaitStmt
)
284 READ_FEATURE(EventWaitStmt::EventWaitSpec
)
285 READ_FEATURE(ExecutableConstruct
)
286 READ_FEATURE(ExecutionPart
)
287 READ_FEATURE(ExecutionPartConstruct
)
288 READ_FEATURE(ExitStmt
)
289 READ_FEATURE(ExplicitCoshapeSpec
)
290 READ_FEATURE(ExplicitShapeSpec
)
292 READ_FEATURE(Expr::Parentheses
)
293 READ_FEATURE(Expr::UnaryPlus
)
294 READ_FEATURE(Expr::Negate
)
295 READ_FEATURE(Expr::NOT
)
296 READ_FEATURE(Expr::PercentLoc
)
297 READ_FEATURE(Expr::DefinedUnary
)
298 READ_FEATURE(Expr::Power
)
299 READ_FEATURE(Expr::Multiply
)
300 READ_FEATURE(Expr::Divide
)
301 READ_FEATURE(Expr::Add
)
302 READ_FEATURE(Expr::Subtract
)
303 READ_FEATURE(Expr::Concat
)
304 READ_FEATURE(Expr::LT
)
305 READ_FEATURE(Expr::LE
)
306 READ_FEATURE(Expr::EQ
)
307 READ_FEATURE(Expr::NE
)
308 READ_FEATURE(Expr::GE
)
309 READ_FEATURE(Expr::GT
)
310 READ_FEATURE(Expr::AND
)
311 READ_FEATURE(Expr::OR
)
312 READ_FEATURE(Expr::EQV
)
313 READ_FEATURE(Expr::NEQV
)
314 READ_FEATURE(Expr::DefinedBinary
)
315 READ_FEATURE(Expr::ComplexConstructor
)
316 READ_FEATURE(External
)
317 READ_FEATURE(ExternalStmt
)
318 READ_FEATURE(FailImageStmt
)
319 READ_FEATURE(FileUnitNumber
)
320 READ_FEATURE(FinalProcedureStmt
)
321 READ_FEATURE(FlushStmt
)
322 READ_FEATURE(ForallAssignmentStmt
)
323 READ_FEATURE(ForallBodyConstruct
)
324 READ_FEATURE(ForallConstruct
)
325 READ_FEATURE(ForallConstructStmt
)
326 READ_FEATURE(ForallStmt
)
327 READ_FEATURE(FormTeamStmt
)
328 READ_FEATURE(FormTeamStmt::FormTeamSpec
)
330 READ_FEATURE(FormatStmt
)
331 READ_FEATURE(FunctionReference
)
332 READ_FEATURE(FunctionStmt
)
333 READ_FEATURE(FunctionSubprogram
)
334 READ_FEATURE(GenericSpec
)
335 READ_FEATURE(GenericSpec::Assignment
)
336 READ_FEATURE(GenericSpec::ReadFormatted
)
337 READ_FEATURE(GenericSpec::ReadUnformatted
)
338 READ_FEATURE(GenericSpec::WriteFormatted
)
339 READ_FEATURE(GenericSpec::WriteUnformatted
)
340 READ_FEATURE(GenericStmt
)
341 READ_FEATURE(GotoStmt
)
342 READ_FEATURE(HollerithLiteralConstant
)
344 READ_FEATURE(IdVariable
)
345 READ_FEATURE(IfConstruct
)
346 READ_FEATURE(IfConstruct::ElseBlock
)
347 READ_FEATURE(IfConstruct::ElseIfBlock
)
349 READ_FEATURE(IfThenStmt
)
350 READ_FEATURE(TeamValue
)
351 READ_FEATURE(ImageSelector
)
352 READ_FEATURE(ImageSelectorSpec
)
353 READ_FEATURE(ImageSelectorSpec::Stat
)
354 READ_FEATURE(ImageSelectorSpec::Team_Number
)
355 READ_FEATURE(ImplicitPart
)
356 READ_FEATURE(ImplicitPartStmt
)
357 READ_FEATURE(ImplicitSpec
)
358 READ_FEATURE(ImplicitStmt
)
359 READ_FEATURE(ImplicitStmt::ImplicitNoneNameSpec
)
360 READ_FEATURE(ImpliedShapeSpec
)
361 READ_FEATURE(ImportStmt
)
362 READ_FEATURE(Initialization
)
363 READ_FEATURE(InputImpliedDo
)
364 READ_FEATURE(InputItem
)
365 READ_FEATURE(InquireSpec
)
366 READ_FEATURE(InquireSpec::CharVar
)
367 READ_FEATURE(InquireSpec::CharVar::Kind
)
368 READ_FEATURE(InquireSpec::IntVar
)
369 READ_FEATURE(InquireSpec::IntVar::Kind
)
370 READ_FEATURE(InquireSpec::LogVar
)
371 READ_FEATURE(InquireSpec::LogVar::Kind
)
372 READ_FEATURE(InquireStmt
)
373 READ_FEATURE(InquireStmt::Iolength
)
374 READ_FEATURE(IntegerTypeSpec
)
375 READ_FEATURE(IntentSpec
)
376 READ_FEATURE(IntentSpec::Intent
)
377 READ_FEATURE(IntentStmt
)
378 READ_FEATURE(InterfaceBlock
)
379 READ_FEATURE(InterfaceBody
)
380 READ_FEATURE(InterfaceBody::Function
)
381 READ_FEATURE(InterfaceBody::Subroutine
)
382 READ_FEATURE(InterfaceSpecification
)
383 READ_FEATURE(InterfaceStmt
)
384 READ_FEATURE(InternalSubprogram
)
385 READ_FEATURE(InternalSubprogramPart
)
386 READ_FEATURE(Intrinsic
)
387 READ_FEATURE(IntrinsicStmt
)
388 READ_FEATURE(IntrinsicTypeSpec
)
389 READ_FEATURE(IntrinsicTypeSpec::Character
)
390 READ_FEATURE(IntrinsicTypeSpec::Complex
)
391 READ_FEATURE(IntrinsicTypeSpec::DoubleComplex
)
392 READ_FEATURE(IntrinsicTypeSpec::DoublePrecision
)
393 READ_FEATURE(IntrinsicTypeSpec::Logical
)
394 READ_FEATURE(IntrinsicTypeSpec::Real
)
395 READ_FEATURE(IoControlSpec
)
396 READ_FEATURE(IoControlSpec::Asynchronous
)
397 READ_FEATURE(IoControlSpec::CharExpr
)
398 READ_FEATURE(IoControlSpec::CharExpr::Kind
)
399 READ_FEATURE(IoControlSpec::Pos
)
400 READ_FEATURE(IoControlSpec::Rec
)
401 READ_FEATURE(IoControlSpec::Size
)
403 READ_FEATURE(Keyword
)
404 READ_FEATURE(KindParam
)
405 READ_FEATURE(KindSelector
)
406 READ_FEATURE(KindSelector::StarSize
)
407 READ_FEATURE(LabelDoStmt
)
408 READ_FEATURE(LanguageBindingSpec
)
409 READ_FEATURE(LengthSelector
)
410 READ_FEATURE(LetterSpec
)
411 READ_FEATURE(LiteralConstant
)
412 READ_FEATURE(IntLiteralConstant
)
413 READ_FEATURE(LocalitySpec
)
414 READ_FEATURE(LocalitySpec::DefaultNone
)
415 READ_FEATURE(LocalitySpec::Local
)
416 READ_FEATURE(LocalitySpec::LocalInit
)
417 READ_FEATURE(LocalitySpec::Shared
)
418 READ_FEATURE(LockStmt
)
419 READ_FEATURE(LockStmt::LockStat
)
420 READ_FEATURE(LogicalLiteralConstant
)
421 READ_FEATURE(LoopControl
)
422 READ_FEATURE(LoopControl::Concurrent
)
423 READ_FEATURE(MainProgram
)
425 READ_FEATURE(Map::EndMapStmt
)
426 READ_FEATURE(Map::MapStmt
)
427 READ_FEATURE(MaskedElsewhereStmt
)
429 READ_FEATURE(ModuleStmt
)
430 READ_FEATURE(ModuleSubprogram
)
431 READ_FEATURE(ModuleSubprogramPart
)
432 READ_FEATURE(MpSubprogramStmt
)
433 READ_FEATURE(MsgVariable
)
435 READ_FEATURE(NamedConstant
)
436 READ_FEATURE(NamedConstantDef
)
437 READ_FEATURE(NamelistStmt
)
438 READ_FEATURE(NamelistStmt::Group
)
439 READ_FEATURE(NonLabelDoStmt
)
441 READ_FEATURE(NullifyStmt
)
442 READ_FEATURE(NullInit
)
443 READ_FEATURE(ObjectDecl
)
444 READ_FEATURE(OldParameterStmt
)
445 READ_FEATURE(OmpAlignedClause
)
446 READ_FEATURE(OmpAtomic
)
447 READ_FEATURE(OmpAtomicCapture
)
448 READ_FEATURE(OmpAtomicCapture::Stmt1
)
449 READ_FEATURE(OmpAtomicCapture::Stmt2
)
450 READ_FEATURE(OmpAtomicRead
)
451 READ_FEATURE(OmpAtomicUpdate
)
452 READ_FEATURE(OmpAtomicWrite
)
453 READ_FEATURE(OmpBeginBlockDirective
)
454 READ_FEATURE(OmpBeginLoopDirective
)
455 READ_FEATURE(OmpBeginSectionsDirective
)
456 READ_FEATURE(OmpBlockDirective
)
457 READ_FEATURE(OmpCancelType
)
458 READ_FEATURE(OmpCancelType::Type
)
459 READ_FEATURE(OmpClause
)
460 READ_FEATURE(OmpClauseList
)
461 READ_FEATURE(OmpCriticalDirective
)
462 READ_FEATURE(OmpDeclareTargetSpecifier
)
463 READ_FEATURE(OmpDeclareTargetWithClause
)
464 READ_FEATURE(OmpDeclareTargetWithList
)
465 READ_FEATURE(OmpDefaultClause
)
466 READ_FEATURE(OmpDefaultClause::Type
)
467 READ_FEATURE(OmpDefaultmapClause
)
468 READ_FEATURE(OmpDefaultmapClause::ImplicitBehavior
)
469 READ_FEATURE(OmpDefaultmapClause::VariableCategory
)
470 READ_FEATURE(OmpDependClause
)
471 READ_FEATURE(OmpDependClause::InOut
)
472 READ_FEATURE(OmpDependClause::Sink
)
473 READ_FEATURE(OmpDependClause::Source
)
474 READ_FEATURE(OmpDependenceType
)
475 READ_FEATURE(OmpDependenceType::Type
)
476 READ_FEATURE(OmpDependSinkVec
)
477 READ_FEATURE(OmpDependSinkVecLength
)
478 READ_FEATURE(OmpEndAllocators
)
479 READ_FEATURE(OmpEndAtomic
)
480 READ_FEATURE(OmpEndBlockDirective
)
481 READ_FEATURE(OmpEndCriticalDirective
)
482 READ_FEATURE(OmpEndLoopDirective
)
483 READ_FEATURE(OmpEndSectionsDirective
)
484 READ_FEATURE(OmpIfClause
)
485 READ_FEATURE(OmpIfClause::DirectiveNameModifier
)
486 READ_FEATURE(OmpLinearClause
)
487 READ_FEATURE(OmpLinearClause::WithModifier
)
488 READ_FEATURE(OmpLinearClause::WithoutModifier
)
489 READ_FEATURE(OmpLinearModifier
)
490 READ_FEATURE(OmpLinearModifier::Type
)
491 READ_FEATURE(OmpLoopDirective
)
492 READ_FEATURE(OmpMapClause
)
493 READ_FEATURE(OmpMapType
)
494 READ_FEATURE(OmpMapType::Always
)
495 READ_FEATURE(OmpMapType::Type
)
496 READ_FEATURE(OmpObject
)
497 READ_FEATURE(OmpObjectList
)
498 READ_FEATURE(OmpOrderClause
)
499 READ_FEATURE(OmpOrderClause::Type
)
500 READ_FEATURE(OmpOrderModifier
)
501 READ_FEATURE(OmpOrderModifier::Kind
)
502 READ_FEATURE(OmpProcBindClause
)
503 READ_FEATURE(OmpProcBindClause::Type
)
504 READ_FEATURE(OmpReductionClause
)
505 READ_FEATURE(OmpInReductionClause
)
506 READ_FEATURE(OmpReductionCombiner
)
507 READ_FEATURE(OmpReductionCombiner::FunctionCombiner
)
508 READ_FEATURE(OmpReductionInitializerClause
)
509 READ_FEATURE(OmpReductionOperator
)
510 READ_FEATURE(OmpAllocateClause
)
511 READ_FEATURE(OmpAllocateClause::AllocateModifier
)
512 READ_FEATURE(OmpAllocateClause::AllocateModifier::Allocator
)
513 READ_FEATURE(OmpAllocateClause::AllocateModifier::ComplexModifier
)
514 READ_FEATURE(OmpAllocateClause::AllocateModifier::Align
)
515 READ_FEATURE(OmpScheduleClause
)
516 READ_FEATURE(OmpScheduleClause::ScheduleType
)
517 READ_FEATURE(OmpDeviceClause
)
518 READ_FEATURE(OmpDeviceClause::DeviceModifier
)
519 READ_FEATURE(OmpDeviceTypeClause
)
520 READ_FEATURE(OmpDeviceTypeClause::Type
)
521 READ_FEATURE(OmpScheduleModifier
)
522 READ_FEATURE(OmpScheduleModifier::Modifier1
)
523 READ_FEATURE(OmpScheduleModifier::Modifier2
)
524 READ_FEATURE(OmpScheduleModifierType
)
525 READ_FEATURE(OmpScheduleModifierType::ModType
)
526 READ_FEATURE(OmpSectionBlocks
)
527 READ_FEATURE(OmpSectionsDirective
)
528 READ_FEATURE(OmpSimpleStandaloneDirective
)
530 READ_FEATURE(OpenACCAtomicConstruct
)
531 READ_FEATURE(OpenACCBlockConstruct
)
532 READ_FEATURE(OpenACCCacheConstruct
)
533 READ_FEATURE(OpenACCCombinedConstruct
)
534 READ_FEATURE(OpenACCConstruct
)
535 READ_FEATURE(OpenACCDeclarativeConstruct
)
536 READ_FEATURE(OpenACCLoopConstruct
)
537 READ_FEATURE(OpenACCRoutineConstruct
)
538 READ_FEATURE(OpenACCStandaloneDeclarativeConstruct
)
539 READ_FEATURE(OpenACCStandaloneConstruct
)
540 READ_FEATURE(OpenACCWaitConstruct
)
541 READ_FEATURE(OpenMPAtomicConstruct
)
542 READ_FEATURE(OpenMPBlockConstruct
)
543 READ_FEATURE(OpenMPCancelConstruct
)
544 READ_FEATURE(OpenMPCancelConstruct::If
)
545 READ_FEATURE(OpenMPCancellationPointConstruct
)
546 READ_FEATURE(OpenMPConstruct
)
547 READ_FEATURE(OpenMPCriticalConstruct
)
548 READ_FEATURE(OpenMPDeclarativeAllocate
)
549 READ_FEATURE(OpenMPDeclarativeConstruct
)
550 READ_FEATURE(OpenMPDeclareReductionConstruct
)
551 READ_FEATURE(OpenMPDeclareSimdConstruct
)
552 READ_FEATURE(OpenMPDeclareTargetConstruct
)
553 READ_FEATURE(OmpMemoryOrderClause
)
554 READ_FEATURE(OmpAtomicClause
)
555 READ_FEATURE(OmpAtomicClauseList
)
556 READ_FEATURE(OmpAtomicDefaultMemOrderClause
)
557 READ_FEATURE(OmpAtomicDefaultMemOrderType
)
558 READ_FEATURE(OpenMPFlushConstruct
)
559 READ_FEATURE(OpenMPLoopConstruct
)
560 READ_FEATURE(OpenMPExecutableAllocate
)
561 READ_FEATURE(OpenMPAllocatorsConstruct
)
562 READ_FEATURE(OpenMPRequiresConstruct
)
563 READ_FEATURE(OpenMPSimpleStandaloneConstruct
)
564 READ_FEATURE(OpenMPStandaloneConstruct
)
565 READ_FEATURE(OpenMPSectionConstruct
)
566 READ_FEATURE(OpenMPSectionsConstruct
)
567 READ_FEATURE(OpenMPThreadprivate
)
568 READ_FEATURE(OpenStmt
)
569 READ_FEATURE(Optional
)
570 READ_FEATURE(OptionalStmt
)
571 READ_FEATURE(OtherSpecificationStmt
)
572 READ_FEATURE(OutputImpliedDo
)
573 READ_FEATURE(OutputItem
)
574 READ_FEATURE(Parameter
)
575 READ_FEATURE(ParameterStmt
)
576 READ_FEATURE(ParentIdentifier
)
578 READ_FEATURE(PauseStmt
)
579 READ_FEATURE(Pointer
)
580 READ_FEATURE(PointerAssignmentStmt
)
581 READ_FEATURE(PointerAssignmentStmt::Bounds
)
582 READ_FEATURE(PointerDecl
)
583 READ_FEATURE(PointerObject
)
584 READ_FEATURE(PointerStmt
)
585 READ_FEATURE(PositionOrFlushSpec
)
586 READ_FEATURE(PrefixSpec
)
587 READ_FEATURE(PrefixSpec::Elemental
)
588 READ_FEATURE(PrefixSpec::Impure
)
589 READ_FEATURE(PrefixSpec::Module
)
590 READ_FEATURE(PrefixSpec::Non_Recursive
)
591 READ_FEATURE(PrefixSpec::Pure
)
592 READ_FEATURE(PrefixSpec::Recursive
)
593 READ_FEATURE(PrintStmt
)
594 READ_FEATURE(PrivateStmt
)
595 READ_FEATURE(PrivateOrSequence
)
596 READ_FEATURE(ProcAttrSpec
)
597 READ_FEATURE(ProcComponentAttrSpec
)
598 READ_FEATURE(ProcComponentDefStmt
)
599 READ_FEATURE(ProcComponentRef
)
600 READ_FEATURE(ProcDecl
)
601 READ_FEATURE(ProcInterface
)
602 READ_FEATURE(ProcPointerInit
)
603 READ_FEATURE(ProcedureDeclarationStmt
)
604 READ_FEATURE(ProcedureDesignator
)
605 READ_FEATURE(ProcedureStmt
)
606 READ_FEATURE(ProcedureStmt::Kind
)
607 READ_FEATURE(Program
)
608 READ_FEATURE(ProgramStmt
)
609 READ_FEATURE(ProgramUnit
)
610 READ_FEATURE(Protected
)
611 READ_FEATURE(ProtectedStmt
)
612 READ_FEATURE(ReadStmt
)
613 READ_FEATURE(RealLiteralConstant
)
614 READ_FEATURE(RealLiteralConstant::Real
)
616 READ_FEATURE(Rename::Names
)
617 READ_FEATURE(Rename::Operators
)
618 READ_FEATURE(ReturnStmt
)
619 READ_FEATURE(RewindStmt
)
621 READ_FEATURE(SaveStmt
)
622 READ_FEATURE(SavedEntity
)
623 READ_FEATURE(SavedEntity::Kind
)
624 READ_FEATURE(SectionSubscript
)
625 READ_FEATURE(SelectCaseStmt
)
626 READ_FEATURE(SelectRankCaseStmt
)
627 READ_FEATURE(SelectRankCaseStmt::Rank
)
628 READ_FEATURE(SelectRankConstruct
)
629 READ_FEATURE(SelectRankConstruct::RankCase
)
630 READ_FEATURE(SelectRankStmt
)
631 READ_FEATURE(SelectTypeConstruct
)
632 READ_FEATURE(SelectTypeConstruct::TypeCase
)
633 READ_FEATURE(SelectTypeStmt
)
634 READ_FEATURE(Selector
)
635 READ_FEATURE(SeparateModuleSubprogram
)
636 READ_FEATURE(SequenceStmt
)
638 READ_FEATURE(SignedComplexLiteralConstant
)
639 READ_FEATURE(SignedIntLiteralConstant
)
640 READ_FEATURE(SignedRealLiteralConstant
)
641 READ_FEATURE(SpecificationConstruct
)
642 READ_FEATURE(SpecificationExpr
)
643 READ_FEATURE(SpecificationPart
)
645 READ_FEATURE(StatOrErrmsg
)
646 READ_FEATURE(StatVariable
)
647 READ_FEATURE(StatusExpr
)
648 READ_FEATURE(StmtFunctionStmt
)
649 READ_FEATURE(StopCode
)
650 READ_FEATURE(StopStmt
)
651 READ_FEATURE(StopStmt::Kind
)
652 READ_FEATURE(StructureComponent
)
653 READ_FEATURE(StructureConstructor
)
654 READ_FEATURE(StructureDef
)
655 READ_FEATURE(StructureDef::EndStructureStmt
)
656 READ_FEATURE(StructureField
)
657 READ_FEATURE(StructureStmt
)
658 READ_FEATURE(Submodule
)
659 READ_FEATURE(SubmoduleStmt
)
660 READ_FEATURE(SubroutineStmt
)
661 READ_FEATURE(SubroutineSubprogram
)
662 READ_FEATURE(SubscriptTriplet
)
663 READ_FEATURE(Substring
)
664 READ_FEATURE(SubstringInquiry
)
665 READ_FEATURE(SubstringRange
)
667 READ_FEATURE(SyncAllStmt
)
668 READ_FEATURE(SyncImagesStmt
)
669 READ_FEATURE(SyncImagesStmt::ImageSet
)
670 READ_FEATURE(SyncMemoryStmt
)
671 READ_FEATURE(SyncTeamStmt
)
673 READ_FEATURE(TargetStmt
)
674 READ_FEATURE(TypeAttrSpec
)
675 READ_FEATURE(TypeAttrSpec::BindC
)
676 READ_FEATURE(TypeAttrSpec::Extends
)
677 READ_FEATURE(TypeBoundGenericStmt
)
678 READ_FEATURE(TypeBoundProcBinding
)
679 READ_FEATURE(TypeBoundProcDecl
)
680 READ_FEATURE(TypeBoundProcedurePart
)
681 READ_FEATURE(TypeBoundProcedureStmt
)
682 READ_FEATURE(TypeBoundProcedureStmt::WithInterface
)
683 READ_FEATURE(TypeBoundProcedureStmt::WithoutInterface
)
684 READ_FEATURE(TypeDeclarationStmt
)
685 READ_FEATURE(TypeGuardStmt
)
686 READ_FEATURE(TypeGuardStmt::Guard
)
687 READ_FEATURE(TypeParamDecl
)
688 READ_FEATURE(TypeParamDefStmt
)
689 READ_FEATURE(common::TypeParamAttr
)
690 READ_FEATURE(TypeParamSpec
)
691 READ_FEATURE(TypeParamValue
)
692 READ_FEATURE(TypeParamValue::Deferred
)
693 READ_FEATURE(TypeSpec
)
695 READ_FEATURE(Union::EndUnionStmt
)
696 READ_FEATURE(Union::UnionStmt
)
697 READ_FEATURE(UnlockStmt
)
698 READ_FEATURE(UseStmt
)
699 READ_FEATURE(UseStmt::ModuleNature
)
701 READ_FEATURE(ValueStmt
)
702 READ_FEATURE(Variable
)
703 READ_FEATURE(Verbatim
)
704 READ_FEATURE(Volatile
)
705 READ_FEATURE(VolatileStmt
)
706 READ_FEATURE(WaitSpec
)
707 READ_FEATURE(WaitStmt
)
708 READ_FEATURE(WhereBodyConstruct
)
709 READ_FEATURE(WhereConstruct
)
710 READ_FEATURE(WhereConstruct::Elsewhere
)
711 READ_FEATURE(WhereConstruct::MaskedElsewhere
)
712 READ_FEATURE(WhereConstructStmt
)
713 READ_FEATURE(WhereStmt
)
714 READ_FEATURE(WriteStmt
)
716 READ_FEATURE(llvm::omp::Directive
)
717 READ_FEATURE(llvm::omp::Clause
)
718 READ_FEATURE(llvm::acc::Directive
)
719 READ_FEATURE(llvm::acc::DefaultValue
)
721 template <typename A
> bool Pre(const A
&) { return true; }
722 template <typename A
> void Post(const A
&) {}
724 template <typename T
> bool Pre(const Statement
<T
> &) { return true; }
725 template <typename T
> void Post(const Statement
<T
> &) {}
727 template <typename T
> bool Pre(const UnlabeledStatement
<T
> &) { return true; }
728 template <typename T
> void Post(const UnlabeledStatement
<T
> &) {}
730 template <typename T
> bool Pre(const common::Indirection
<T
> &) {
733 template <typename T
> void Post(const common::Indirection
<T
> &) {}
735 template <typename A
> bool Pre(const Scalar
<A
> &) { return true; }
736 template <typename A
> void Post(const Scalar
<A
> &) {}
738 template <typename A
> bool Pre(const Constant
<A
> &) { return true; }
739 template <typename A
> void Post(const Constant
<A
> &) {}
741 template <typename A
> bool Pre(const Integer
<A
> &) { return true; }
742 template <typename A
> void Post(const Integer
<A
> &) {}
744 template <typename A
> bool Pre(const Logical
<A
> &) { return true; }
745 template <typename A
> void Post(const Logical
<A
> &) {}
747 template <typename A
> bool Pre(const DefaultChar
<A
> &) { return true; }
748 template <typename A
> void Post(const DefaultChar
<A
> &) {}
750 template <typename
... A
> bool Pre(const std::tuple
<A
...> &) { return true; }
751 template <typename
... A
> void Post(const std::tuple
<A
...> &) {}
753 template <typename
... A
> bool Pre(const std::variant
<A
...> &) { return true; }
754 template <typename
... A
> void Post(const std::variant
<A
...> &) {}
757 bool sortNodes(std::pair
<const char *, int> a
, std::pair
<const char *, int> b
) {
758 return (a
.second
== b
.second
) ? (std::strcmp(a
.first
, b
.first
) < 0)
759 : a
.second
> b
.second
;
762 class FeatureListAction
: public PluginParseTreeAction
{
763 void executeAction() override
{
765 Fortran::parser::Walk(getParsing().parseTree(), visitor
);
767 const auto &frequencyMap
= visitor
.getFrequencies();
768 std::vector
<std::pair
<const char *, int>> frequencies(
769 frequencyMap
.begin(), frequencyMap
.end());
771 std::sort(frequencies
.begin(), frequencies
.end(), sortNodes
);
772 for (auto const &[feature
, frequency
] : frequencies
) {
773 llvm::outs() << feature
<< ": " << frequency
<< "\n";
777 bool beginSourceFileAction() override
{ return runPrescan() && runParse(); }
780 static FrontendPluginRegistry::Add
<FeatureListAction
> X(
781 "feature-list", "List program features");