[PATCH] D143704: [flang] Part one of Feature List action

2023-03-06 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough updated this revision to Diff 502691.
elmcdonough retitled this revision from "[Flang] Part one of Feature List 
action" to "[flang] Part one of Feature List action".
elmcdonough added a comment.

Allow for plugin to parse semantically incorrect files.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143704/new/

https://reviews.llvm.org/D143704

Files:
  flang/examples/CMakeLists.txt
  flang/examples/FeatureList/CMakeLists.txt
  flang/examples/FeatureList/FeatureList.cpp
  flang/test/Examples/feature-list-class.f90
  flang/test/Examples/feature-list-functions.f90

Index: flang/test/Examples/feature-list-functions.f90
===
--- /dev/null
+++ flang/test/Examples/feature-list-functions.f90
@@ -0,0 +1,76 @@
+! UNSUPPORTED: system-windows
+! REQUIRES: plugins, shell, examples
+
+! RUN: %flang_fc1 -load %llvmshlibdir/flangFeatureList.so \
+! RUN:-plugin feature-list %s 2>&1 | FileCheck %s
+
+program list_features_test
+implicit none
+call test_sub(test_func(2, 3), 4)
+contains
+subroutine test_sub(a, b)
+integer, intent(in) :: a, b
+print "(I0)", a + b
+end subroutine
+
+integer function test_func(a, b)
+integer, intent(in) :: a, b
+test_func = a * b
+end function
+end program list_features_test
+
+! CHECK: Name: 19
+! CHECK-NEXT: IntLiteralConstant: 3
+! CHECK-NEXT: LiteralConstant: 4
+! CHECK-NEXT: CharLiteralConstant: 1
+! CHECK-NEXT: FunctionReference: 1
+! CHECK-NEXT: Call: 2
+! CHECK-NEXT: Expr::Multiply: 1
+! CHECK-NEXT: Expr::Add: 1
+! CHECK-NEXT: IntrinsicTypeSpec: 3
+! CHECK-NEXT: IntegerTypeSpec: 3
+! CHECK-NEXT: Format: 1
+! CHECK-NEXT: DataRef: 5
+! CHECK-NEXT: ProcedureDesignator: 2
+! CHECK-NEXT: Designator: 5
+! CHECK-NEXT: ActualArgSpec: 4
+! CHECK-NEXT: ActualArg: 4
+! CHECK-NEXT: Expr: 11
+! CHECK-NEXT: Variable: 1
+! CHECK-NEXT: AttrSpec: 2
+! CHECK-NEXT: IntentSpec: 2
+! CHECK-NEXT: IntentSpec::Intent: 2
+! CHECK-NEXT: DummyArg: 2
+! CHECK-NEXT: DeclarationTypeSpec: 3
+! CHECK-NEXT: ImplicitStmt: 1
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: ImplicitPartStmt: 1
+! CHECK-NEXT: PrefixSpec: 1
+! CHECK-NEXT: OutputItem: 1
+! CHECK-NEXT: AssignmentStmt: 1
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: PrintStmt: 1
+! CHECK-NEXT: CallStmt: 1
+! CHECK-NEXT: Block: 3
+! CHECK-NEXT: ContainsStmt: 1
+! CHECK-NEXT: EntityDecl: 4
+! CHECK-NEXT: SpecificationConstruct: 2
+! CHECK-NEXT: TypeDeclarationStmt: 2
+! CHECK-NEXT: DeclarationConstruct: 2
+! CHECK-NEXT: EndFunctionStmt: 1
+! CHECK-NEXT: FunctionStmt: 1
+! CHECK-NEXT: EndSubroutineStmt: 1
+! CHECK-NEXT: SubroutineStmt: 1
+! CHECK-NEXT: ExecutionPartConstruct: 3
+! CHECK-NEXT: ExecutableConstruct: 3
+! CHECK-NEXT: SpecificationPart: 3
+! CHECK-NEXT: FunctionSubprogram: 1
+! CHECK-NEXT: ExecutionPart: 3
+! CHECK-NEXT: InternalSubprogramPart: 1
+! CHECK-NEXT: InternalSubprogram: 2
+! CHECK-NEXT: SubroutineSubprogram: 1
+! CHECK-NEXT: ProgramUnit: 1
+! CHECK-NEXT: MainProgram: 1
+! CHECK-NEXT: Program: 1
+! CHECK-NEXT: EndProgramStmt: 1
+! CHECK-NEXT: ProgramStmt: 1
Index: flang/test/Examples/feature-list-class.f90
===
--- /dev/null
+++ flang/test/Examples/feature-list-class.f90
@@ -0,0 +1,88 @@
+! UNSUPPORTED: system-windows
+! REQUIRES: plugins, shell, examples
+
+! RUN: %flang_fc1 -load %llvmshlibdir/flangFeatureList.so \
+! RUN:-plugin feature-list %s 2>&1 | FileCheck %s
+
+module list_features_test
+implicit none
+
+type :: test_class_1
+integer :: a
+real :: b
+contains
+procedure :: sum => sum_test_class_1
+procedure :: set => set_values_test_class_1
+end type
+contains
+real function sum_test_class_1(self)
+class(test_class_1), intent(in) :: self
+sum_test_class_1 = self%a + self%b
+end function
+
+subroutine set_values_test_class_1(self, a, b)
+class(test_class_1), intent(out) :: self
+integer, intent(in) :: a, b
+self%a = a
+self%b = b
+end subroutine
+end module list_features_test
+
+! CHECK: Name: 32
+! CHECK-NEXT: DerivedTypeSpec: 2
+! CHECK-NEXT: Expr::Add: 1
+! CHECK-NEXT: IntrinsicTypeSpec: 4
+! CHECK-NEXT: IntegerTypeSpec: 2
+! CHECK-NEXT: IntrinsicTypeSpec::Real: 2
+! CHECK-NEXT: DataRef: 11
+! CHECK-NEXT: StructureComponent: 4
+! CHECK-NEXT: Designator: 7
+! CHECK-NEXT: Expr: 5
+! CHECK-NEXT: Variable: 3
+! CHECK-NEXT: AttrSpec: 3
+! CHECK-NEXT: IntentSpec: 3
+! CHECK-NEXT: IntentSpec::Intent: 3
+! CHECK-NEXT: DummyArg: 3
+! CHECK-NEXT: DeclarationTypeSpec: 6
+! CHECK-NEXT: DeclarationTypeSpec::Class: 2
+! CHECK-NEXT: ImplicitStmt: 1
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: ImplicitPartStmt: 1
+! CHECK-NEXT: PrefixSpec: 1
+! CHECK-NEXT: Module: 1
+! CHECK-NEXT: AssignmentStmt: 3
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: Block: 2
+! CHECK-NEXT: TypeBoundProc

[PATCH] D143704: [Flang] Part one of Feature List action

2023-03-02 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough updated this revision to Diff 501919.
elmcdonough added a comment.

Clang format


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143704/new/

https://reviews.llvm.org/D143704

Files:
  flang/examples/CMakeLists.txt
  flang/examples/FeatureList/CMakeLists.txt
  flang/examples/FeatureList/FeatureList.cpp
  flang/test/Examples/feature-list-class.f90
  flang/test/Examples/feature-list-functions.f90

Index: flang/test/Examples/feature-list-functions.f90
===
--- /dev/null
+++ flang/test/Examples/feature-list-functions.f90
@@ -0,0 +1,76 @@
+! UNSUPPORTED: system-windows
+! REQUIRES: plugins, shell, examples
+
+! RUN: %flang_fc1 -load %llvmshlibdir/flangFeatureList.so \
+! RUN:-plugin feature-list %s 2>&1 | FileCheck %s
+
+program list_features_test
+implicit none
+call test_sub(test_func(2, 3), 4)
+contains
+subroutine test_sub(a, b)
+integer, intent(in) :: a, b
+print "(I0)", a + b
+end subroutine
+
+integer function test_func(a, b)
+integer, intent(in) :: a, b
+test_func = a * b
+end function
+end program list_features_test
+
+! CHECK: Name: 19
+! CHECK-NEXT: IntLiteralConstant: 3
+! CHECK-NEXT: LiteralConstant: 4
+! CHECK-NEXT: CharLiteralConstant: 1
+! CHECK-NEXT: FunctionReference: 1
+! CHECK-NEXT: Call: 2
+! CHECK-NEXT: Expr::Multiply: 1
+! CHECK-NEXT: Expr::Add: 1
+! CHECK-NEXT: IntrinsicTypeSpec: 3
+! CHECK-NEXT: IntegerTypeSpec: 3
+! CHECK-NEXT: Format: 1
+! CHECK-NEXT: DataRef: 5
+! CHECK-NEXT: ProcedureDesignator: 2
+! CHECK-NEXT: Designator: 5
+! CHECK-NEXT: ActualArgSpec: 4
+! CHECK-NEXT: ActualArg: 4
+! CHECK-NEXT: Expr: 11
+! CHECK-NEXT: Variable: 1
+! CHECK-NEXT: AttrSpec: 2
+! CHECK-NEXT: IntentSpec: 2
+! CHECK-NEXT: IntentSpec::Intent: 2
+! CHECK-NEXT: DummyArg: 2
+! CHECK-NEXT: DeclarationTypeSpec: 3
+! CHECK-NEXT: ImplicitStmt: 1
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: ImplicitPartStmt: 1
+! CHECK-NEXT: PrefixSpec: 1
+! CHECK-NEXT: OutputItem: 1
+! CHECK-NEXT: AssignmentStmt: 1
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: PrintStmt: 1
+! CHECK-NEXT: CallStmt: 1
+! CHECK-NEXT: Block: 3
+! CHECK-NEXT: ContainsStmt: 1
+! CHECK-NEXT: EntityDecl: 4
+! CHECK-NEXT: SpecificationConstruct: 2
+! CHECK-NEXT: TypeDeclarationStmt: 2
+! CHECK-NEXT: DeclarationConstruct: 2
+! CHECK-NEXT: EndFunctionStmt: 1
+! CHECK-NEXT: FunctionStmt: 1
+! CHECK-NEXT: EndSubroutineStmt: 1
+! CHECK-NEXT: SubroutineStmt: 1
+! CHECK-NEXT: ExecutionPartConstruct: 3
+! CHECK-NEXT: ExecutableConstruct: 3
+! CHECK-NEXT: SpecificationPart: 3
+! CHECK-NEXT: FunctionSubprogram: 1
+! CHECK-NEXT: ExecutionPart: 3
+! CHECK-NEXT: InternalSubprogramPart: 1
+! CHECK-NEXT: InternalSubprogram: 2
+! CHECK-NEXT: SubroutineSubprogram: 1
+! CHECK-NEXT: ProgramUnit: 1
+! CHECK-NEXT: MainProgram: 1
+! CHECK-NEXT: Program: 1
+! CHECK-NEXT: EndProgramStmt: 1
+! CHECK-NEXT: ProgramStmt: 1
Index: flang/test/Examples/feature-list-class.f90
===
--- /dev/null
+++ flang/test/Examples/feature-list-class.f90
@@ -0,0 +1,88 @@
+! UNSUPPORTED: system-windows
+! REQUIRES: plugins, shell, examples
+
+! RUN: %flang_fc1 -load %llvmshlibdir/flangFeatureList.so \
+! RUN:-plugin feature-list %s 2>&1 | FileCheck %s
+
+module list_features_test
+implicit none
+
+type :: test_class_1
+integer :: a
+real :: b
+contains
+procedure :: sum => sum_test_class_1
+procedure :: set => set_values_test_class_1
+end type
+contains
+real function sum_test_class_1(self)
+class(test_class_1), intent(in) :: self
+sum_test_class_1 = self%a + self%b
+end function
+
+subroutine set_values_test_class_1(self, a, b)
+class(test_class_1), intent(out) :: self
+integer, intent(in) :: a, b
+self%a = a
+self%b = b
+end subroutine
+end module list_features_test
+
+! CHECK: Name: 32
+! CHECK-NEXT: DerivedTypeSpec: 2
+! CHECK-NEXT: Expr::Add: 1
+! CHECK-NEXT: IntrinsicTypeSpec: 4
+! CHECK-NEXT: IntegerTypeSpec: 2
+! CHECK-NEXT: IntrinsicTypeSpec::Real: 2
+! CHECK-NEXT: DataRef: 11
+! CHECK-NEXT: StructureComponent: 4
+! CHECK-NEXT: Designator: 7
+! CHECK-NEXT: Expr: 5
+! CHECK-NEXT: Variable: 3
+! CHECK-NEXT: AttrSpec: 3
+! CHECK-NEXT: IntentSpec: 3
+! CHECK-NEXT: IntentSpec::Intent: 3
+! CHECK-NEXT: DummyArg: 3
+! CHECK-NEXT: DeclarationTypeSpec: 6
+! CHECK-NEXT: DeclarationTypeSpec::Class: 2
+! CHECK-NEXT: ImplicitStmt: 1
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: ImplicitPartStmt: 1
+! CHECK-NEXT: PrefixSpec: 1
+! CHECK-NEXT: Module: 1
+! CHECK-NEXT: AssignmentStmt: 3
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: Block: 2
+! CHECK-NEXT: TypeBoundProcBinding: 2
+! CHECK-NEXT: TypeBoundProcedureStmt: 2
+! CHECK-NEXT: TypeBoundProcDecl: 2
+! CHECK-NEXT: TypeBoundProcedureStmt::WithoutInterface: 2
+! CHECK-NEXT: ComponentO

[PATCH] D143704: [Flang] Part one of Feature List action

2023-03-01 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough updated this revision to Diff 501720.
elmcdonough edited the summary of this revision.
elmcdonough removed reviewers: klausler, clementval.
elmcdonough added a comment.
Herald added a subscriber: sstefan1.

Tests + total coverage of elements inside dump-parse-tree.h


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143704/new/

https://reviews.llvm.org/D143704

Files:
  flang/examples/CMakeLists.txt
  flang/examples/FeatureList/CMakeLists.txt
  flang/examples/FeatureList/FeatureList.cpp
  flang/test/Examples/feature-list-class.f90
  flang/test/Examples/feature-list-functions.f90

Index: flang/test/Examples/feature-list-functions.f90
===
--- /dev/null
+++ flang/test/Examples/feature-list-functions.f90
@@ -0,0 +1,76 @@
+! UNSUPPORTED: system-windows
+! REQUIRES: plugins, shell, examples
+
+! RUN: %flang_fc1 -load %llvmshlibdir/flangFeatureList.so \
+! RUN:-plugin feature-list %s 2>&1 | FileCheck %s
+
+program list_features_test
+implicit none
+call test_sub(test_func(2, 3), 4)
+contains
+subroutine test_sub(a, b)
+integer, intent(in) :: a, b
+print "(I0)", a + b
+end subroutine
+
+integer function test_func(a, b)
+integer, intent(in) :: a, b
+test_func = a * b
+end function
+end program list_features_test
+
+! CHECK: Name: 19
+! CHECK-NEXT: IntLiteralConstant: 3
+! CHECK-NEXT: LiteralConstant: 4
+! CHECK-NEXT: CharLiteralConstant: 1
+! CHECK-NEXT: FunctionReference: 1
+! CHECK-NEXT: Call: 2
+! CHECK-NEXT: Expr::Multiply: 1
+! CHECK-NEXT: Expr::Add: 1
+! CHECK-NEXT: IntrinsicTypeSpec: 3
+! CHECK-NEXT: IntegerTypeSpec: 3
+! CHECK-NEXT: Format: 1
+! CHECK-NEXT: DataRef: 5
+! CHECK-NEXT: ProcedureDesignator: 2
+! CHECK-NEXT: Designator: 5
+! CHECK-NEXT: ActualArgSpec: 4
+! CHECK-NEXT: ActualArg: 4
+! CHECK-NEXT: Expr: 11
+! CHECK-NEXT: Variable: 1
+! CHECK-NEXT: AttrSpec: 2
+! CHECK-NEXT: IntentSpec: 2
+! CHECK-NEXT: IntentSpec::Intent: 2
+! CHECK-NEXT: DummyArg: 2
+! CHECK-NEXT: DeclarationTypeSpec: 3
+! CHECK-NEXT: ImplicitStmt: 1
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: ImplicitPartStmt: 1
+! CHECK-NEXT: PrefixSpec: 1
+! CHECK-NEXT: OutputItem: 1
+! CHECK-NEXT: AssignmentStmt: 1
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: PrintStmt: 1
+! CHECK-NEXT: CallStmt: 1
+! CHECK-NEXT: Block: 3
+! CHECK-NEXT: ContainsStmt: 1
+! CHECK-NEXT: EntityDecl: 4
+! CHECK-NEXT: SpecificationConstruct: 2
+! CHECK-NEXT: TypeDeclarationStmt: 2
+! CHECK-NEXT: DeclarationConstruct: 2
+! CHECK-NEXT: EndFunctionStmt: 1
+! CHECK-NEXT: FunctionStmt: 1
+! CHECK-NEXT: EndSubroutineStmt: 1
+! CHECK-NEXT: SubroutineStmt: 1
+! CHECK-NEXT: ExecutionPartConstruct: 3
+! CHECK-NEXT: ExecutableConstruct: 3
+! CHECK-NEXT: SpecificationPart: 3
+! CHECK-NEXT: FunctionSubprogram: 1
+! CHECK-NEXT: ExecutionPart: 3
+! CHECK-NEXT: InternalSubprogramPart: 1
+! CHECK-NEXT: InternalSubprogram: 2
+! CHECK-NEXT: SubroutineSubprogram: 1
+! CHECK-NEXT: ProgramUnit: 1
+! CHECK-NEXT: MainProgram: 1
+! CHECK-NEXT: Program: 1
+! CHECK-NEXT: EndProgramStmt: 1
+! CHECK-NEXT: ProgramStmt: 1
Index: flang/test/Examples/feature-list-class.f90
===
--- /dev/null
+++ flang/test/Examples/feature-list-class.f90
@@ -0,0 +1,88 @@
+! UNSUPPORTED: system-windows
+! REQUIRES: plugins, shell, examples
+
+! RUN: %flang_fc1 -load %llvmshlibdir/flangFeatureList.so \
+! RUN:-plugin feature-list %s 2>&1 | FileCheck %s
+
+module list_features_test
+implicit none
+
+type :: test_class_1
+integer :: a
+real :: b
+contains
+procedure :: sum => sum_test_class_1
+procedure :: set => set_values_test_class_1
+end type
+contains
+real function sum_test_class_1(self)
+class(test_class_1), intent(in) :: self
+sum_test_class_1 = self%a + self%b
+end function
+
+subroutine set_values_test_class_1(self, a, b)
+class(test_class_1), intent(out) :: self
+integer, intent(in) :: a, b
+self%a = a
+self%b = b
+end subroutine
+end module list_features_test
+
+! CHECK: Name: 32
+! CHECK-NEXT: DerivedTypeSpec: 2
+! CHECK-NEXT: Expr::Add: 1
+! CHECK-NEXT: IntrinsicTypeSpec: 4
+! CHECK-NEXT: IntegerTypeSpec: 2
+! CHECK-NEXT: IntrinsicTypeSpec::Real: 2
+! CHECK-NEXT: DataRef: 11
+! CHECK-NEXT: StructureComponent: 4
+! CHECK-NEXT: Designator: 7
+! CHECK-NEXT: Expr: 5
+! CHECK-NEXT: Variable: 3
+! CHECK-NEXT: AttrSpec: 3
+! CHECK-NEXT: IntentSpec: 3
+! CHECK-NEXT: IntentSpec::Intent: 3
+! CHECK-NEXT: DummyArg: 3
+! CHECK-NEXT: DeclarationTypeSpec: 6
+! CHECK-NEXT: DeclarationTypeSpec::Class: 2
+! CHECK-NEXT: ImplicitStmt: 1
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: ImplicitPartStmt: 1
+! CHECK-NEXT: PrefixSpec: 1
+! CHECK-NEXT: Module: 1
+! CHECK-NEXT: AssignmentStmt: 3
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: Block: 2
+! CHECK-NEXT:

[PATCH] D143704: [Flang] Part one of Feature List action

2023-02-25 Thread Andrzej Warzynski via Phabricator via cfe-commits
awarzynski added a comment.

In D143704#4150680 , @jdoerfert wrote:

> can we have a test?

+1




Comment at: flang/examples/FeatureList/FeatureList.cpp:34
+
+struct ASTVisitor {
+private:

There is no AST in Flang - could you propose something more descriptive?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143704/new/

https://reviews.llvm.org/D143704

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D143704: [Flang] Part one of Feature List action

2023-02-24 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

can we have a test?




Comment at: flang/examples/FeatureList/FeatureList.cpp:605
+  template  bool Pre(const std::variant &) { return true; 
}
+  template  void Post(const std::variant &) {}
+};

Can you record the features we missed so we can update the list once in a while.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143704/new/

https://reviews.llvm.org/D143704

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D143704: [Flang] Part one of Feature List action

2023-02-17 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough updated this revision to Diff 498561.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143704/new/

https://reviews.llvm.org/D143704

Files:
  flang/examples/CMakeLists.txt
  flang/examples/FeatureList/CMakeLists.txt
  flang/examples/FeatureList/FeatureList.cpp

Index: flang/examples/FeatureList/FeatureList.cpp
===
--- /dev/null
+++ flang/examples/FeatureList/FeatureList.cpp
@@ -0,0 +1,620 @@
+//===-- FeatureList.cpp ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// A plugin that counts the amount of times a particular AST node occurs
+//
+//===--===//
+
+#include "flang/Frontend/FrontendActions.h"
+#include "flang/Frontend/FrontendPluginRegistry.h"
+#include "flang/Parser/parse-tree-visitor.h"
+#include "flang/Parser/parse-tree.h"
+#include "flang/Parser/parsing.h"
+
+#include 
+
+using namespace Fortran::frontend;
+using namespace Fortran::parser;
+using namespace Fortran;
+
+#define READ_FEATURE_CUST(classname, n) \
+  bool Pre(const classname &) { \
+record(#n); \
+return true; \
+  } \
+  void Post(const classname &) {}
+
+#define READ_FEATURE(classname) READ_FEATURE_CUST(classname, classname)
+
+struct ASTVisitor {
+private:
+  std::map frequencies;
+
+  void record(const char *name) {
+const auto [it, ins] = frequencies.insert({name, 1});
+if (!ins) {
+  frequencies[name] = it->second + 1;
+}
+  }
+
+public:
+  const std::map &getFrequencies() const {
+return frequencies;
+  }
+
+  READ_FEATURE_CUST(format::ControlEditDesc, ControlEditDesc)
+  READ_FEATURE_CUST(format::DerivedTypeDataEditDesc, DerivedTypeDataEditDesc)
+  READ_FEATURE_CUST(format::FormatItem, FormatItem)
+  READ_FEATURE_CUST(format::FormatSpecification, FormatSpecification)
+  READ_FEATURE_CUST(
+  format::IntrinsicTypeDataEditDesc, IntrinsicTypeDataEditDesc)
+  READ_FEATURE(Abstract)
+  READ_FEATURE(AccAtomicCapture)
+  READ_FEATURE(AccAtomicCapture::Stmt1)
+  READ_FEATURE(AccAtomicCapture::Stmt2)
+  READ_FEATURE(AccAtomicRead)
+  READ_FEATURE(AccAtomicUpdate)
+  READ_FEATURE(AccAtomicWrite)
+  READ_FEATURE(AccBeginBlockDirective)
+  READ_FEATURE(AccBeginCombinedDirective)
+  READ_FEATURE(AccBeginLoopDirective)
+  READ_FEATURE(AccBlockDirective)
+  READ_FEATURE(AccClause)
+  READ_FEATURE(AccBindClause)
+  READ_FEATURE(AccDefaultClause)
+  READ_FEATURE(AccClauseList)
+  READ_FEATURE(AccCombinedDirective)
+  READ_FEATURE(AccDataModifier)
+  READ_FEATURE(AccDeclarativeDirective)
+  READ_FEATURE(AccEndAtomic)
+  READ_FEATURE(AccEndBlockDirective)
+  READ_FEATURE(AccEndCombinedDirective)
+  READ_FEATURE(AccGangArgument)
+  READ_FEATURE(AccObject)
+  READ_FEATURE(AccObjectList)
+  READ_FEATURE(AccObjectListWithModifier)
+  READ_FEATURE(AccObjectListWithReduction)
+  READ_FEATURE(AccReductionOperator)
+  READ_FEATURE(AccSizeExpr)
+  READ_FEATURE(AccSizeExprList)
+  READ_FEATURE(AccSelfClause)
+  READ_FEATURE(AccStandaloneDirective)
+  READ_FEATURE(AccDeviceTypeExpr)
+  READ_FEATURE(AccDeviceTypeExprList)
+  READ_FEATURE(AccTileExpr)
+  READ_FEATURE(AccTileExprList)
+  READ_FEATURE(AccLoopDirective)
+  READ_FEATURE(AccWaitArgument)
+  READ_FEATURE(AcImpliedDo)
+  READ_FEATURE(AcImpliedDoControl)
+  READ_FEATURE(AcValue)
+  READ_FEATURE(AccessStmt)
+  READ_FEATURE(AccessId)
+  READ_FEATURE(AccessSpec)
+  READ_FEATURE(AcSpec)
+  READ_FEATURE(ActionStmt)
+  READ_FEATURE(ActualArg)
+  READ_FEATURE(ActualArg::PercentRef)
+  READ_FEATURE(ActualArg::PercentVal)
+  READ_FEATURE(ActualArgSpec)
+  READ_FEATURE(AcValue::Triplet)
+  READ_FEATURE(AllocOpt)
+  READ_FEATURE(AllocOpt::Mold)
+  READ_FEATURE(AllocOpt::Source)
+  READ_FEATURE(Allocatable)
+  READ_FEATURE(AllocatableStmt)
+  READ_FEATURE(AllocateCoarraySpec)
+  READ_FEATURE(AllocateObject)
+  READ_FEATURE(AllocateShapeSpec)
+  READ_FEATURE(AllocateStmt)
+  READ_FEATURE(Allocation)
+  READ_FEATURE(AltReturnSpec)
+  READ_FEATURE(ArithmeticIfStmt)
+  READ_FEATURE(ArrayConstructor)
+  READ_FEATURE(ArrayElement)
+  READ_FEATURE(ArraySpec)
+  READ_FEATURE(AssignStmt)
+  READ_FEATURE(AssignedGotoStmt)
+  READ_FEATURE(AssignmentStmt)
+  READ_FEATURE(AssociateConstruct)
+  READ_FEATURE(AssociateStmt)
+  READ_FEATURE(Association)
+  READ_FEATURE(AssumedImpliedSpec)
+  READ_FEATURE(AssumedRankSpec)
+  READ_FEATURE(AssumedShapeSpec)
+  READ_FEATURE(AssumedSizeSpec)
+  READ_FEATURE(Asynchronous)
+  READ_FEATURE(AsynchronousStmt)
+  READ_FEATURE(AttrSpec)
+  READ_FEATURE(BOZLiteralConstant)
+  READ_FEATURE(BackspaceStmt)
+  READ_FEATURE(BasedPointer)
+  READ_FEATURE(BasedPointerStmt)
+  

[PATCH] D143704: [Flang] Part one of Feature List action

2023-02-16 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough added a comment.

Thank you all for your feedback.  We're putting the second part off for now and 
I'm going to retool this as a plugin.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143704/new/

https://reviews.llvm.org/D143704

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D143704: [Flang] Part one of Feature List action

2023-02-16 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

> However, it should be considered harmful to make the TODO macro always 
> associate with some syntactic source artifact. It would also be unwise to 
> redefine TODO from a halt semantics to a "just keep going and see what 
> happens" semantics.

@schweitz Why? What's the inherent harm to do that under a flag in an 
experimental compiler that is called `...-new`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143704/new/

https://reviews.llvm.org/D143704

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D143704: [Flang] Part one of Feature List action

2023-02-16 Thread Kiran Chandramohan via Phabricator via cfe-commits
kiranchandramohan added a comment.

FWIW, We have a plugin 
(https://github.com/llvm/llvm-project/tree/main/flang/examples/FlangOmpReport) 
that goes over the parse-tree and reports all the OpenMP constructs and clauses 
seen.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143704/new/

https://reviews.llvm.org/D143704

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D143704: [Flang] Part one of Feature List action

2023-02-16 Thread Eric Schweitz via Phabricator via cfe-commits
schweitz added a comment.

I should've mentioned in my comment that the TODO macros are meant to be 
deleted. Some day, there will be no more TODOs and there should be a huge 
celebration.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143704/new/

https://reviews.llvm.org/D143704

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D143704: [Flang] Part one of Feature List action

2023-02-16 Thread Eric Schweitz via Phabricator via cfe-commits
schweitz added a comment.

In D143704#4130124 , @jdoerfert wrote:

> In D143704#4130062 , @clementval 
> wrote:
>
>> Where is this coming from? Did I miss where this was discussed.
>
> It's discussed here, for now. :)
>
>> You will not be able to find all not implemented features by going on 
>> through the AST. Most of the not implemented message are triggered by 
>> lowering.
>
> Right. Let's take a step back.
> First, this allows us to identify (and count) features used by an app 
> programmatically. This is in itself useful and we should not intertwine it 
> with the (non-)implemented parts (see my comment from before).
> Next, we want to identify if a "feature" is implemented or not. This is 
> arguably not a straight forward task and also not 100% tied to AST nodes, 
> however, it would be a useful capability for the time being.
> One idea was to extend the `TODO` function to include some tie to a AST 
> entity. That will work sometimes, and sometimes it won't. In either case it 
> is unclear how we can continue lowering (or whatever stage the TODO is in).
> Thus, we might want to manually associate the existing `TODO`s with AST 
> features in a map we maintain. So we run this counting scheme, then lookup 
> each entity in the map, and provide feedback if it is supported, not 
> supported, or partially supported (or unknown).
> All that said, let's separate the concerns into 1) listing of features, and 
> 2) assigning implementation status. This patch does only the former and 
> should be reviewed as such.

For some background context:

TODO is a macro. It had 2 purposes. 1. Developers: easy to grep for and find. 
2. Developers and users: imposing a practice where flang would halt 
(semi-)meaningfully rather than generate garbage output for the user to wade 
through.

It has no association with the parse tree. (Flang doesn't have an AST to my 
knowledge.) The flang parser has its own diagnostics reporting system.

TODO is flexible enough to allow different diagnostic systems to be used, 
different sorts of fatal exits to report different information, etc.

However, it should be considered harmful to make the TODO macro always 
associate with some syntactic source artifact. It would also be unwise to 
redefine TODO from a halt semantics to a "just keep going and see what happens" 
semantics.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143704/new/

https://reviews.llvm.org/D143704

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits