[PATCH] D143704: [flang] Feature list plugin

2023-03-16 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough added a comment.
Herald added a subscriber: jplehr.

ping


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] Feature list plugin

2023-03-17 Thread Ethan Luis McDonough via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbde91fd03f72: [flang] Feature list plugin (authored by 
elmcdonough).

Changed prior to commit:
  https://reviews.llvm.org/D143704?vs=502691&id=505991#toc

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
+! CHEC

[PATCH] D143704: [flang] Feature list plugin

2023-03-17 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough added a comment.

Haven't been able to check this yet, but I think it might be due to the tests 
expecting a deterministic output.  I've only ever tested on Ubuntu WSL, so its 
possible the order is different on different platforms.  I think replacing 
CHECK-NEXT with CHECK-DAG might fix the issue.


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] Feature list plugin

2023-03-17 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough added a comment.

Sorry about that.  I was trying to look for a fix, and I think it has something 
to do with these recent changes 
.
  I'll have a new revision soon.


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] Feature list plugin

2023-03-21 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough updated this revision to Diff 507231.

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/CMakeLists.txt
  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%pluginext \
+! 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%pluginext \
+! 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: ComponentOrFill: 2
+! CHECK-NEXT: ComponentDecl: 2

[PATCH] D143704: [flang] Feature list plugin

2023-03-22 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough added a comment.

Could you post a link to the failed build please @Renaud-K?  I'd like to see if 
I can diagnose what's going wrong.


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] Feature list plugin

2023-03-22 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough updated this revision to Diff 507486.

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/CMakeLists.txt
  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%pluginext \
+! 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%pluginext \
+! 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: ComponentOrF

[PATCH] D143704: [flang] Feature list plugin

2023-03-22 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough updated this revision to Diff 507572.
Herald added a subscriber: mgrang.

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/CMakeLists.txt
  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%pluginext \
+! 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: Expr: 11
+! CHECK-NEXT: DataRef: 5
+! CHECK-NEXT: Designator: 5
+! CHECK-NEXT: ActualArg: 4
+! CHECK-NEXT: ActualArgSpec: 4
+! CHECK-NEXT: EntityDecl: 4
+! CHECK-NEXT: LiteralConstant: 4
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: Block: 3
+! CHECK-NEXT: DeclarationTypeSpec: 3
+! CHECK-NEXT: ExecutableConstruct: 3
+! CHECK-NEXT: ExecutionPart: 3
+! CHECK-NEXT: ExecutionPartConstruct: 3
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: IntLiteralConstant: 3
+! CHECK-NEXT: IntegerTypeSpec: 3
+! CHECK-NEXT: IntrinsicTypeSpec: 3
+! CHECK-NEXT: SpecificationPart: 3
+! CHECK-NEXT: AttrSpec: 2
+! CHECK-NEXT: Call: 2
+! CHECK-NEXT: DeclarationConstruct: 2
+! CHECK-NEXT: DummyArg: 2
+! CHECK-NEXT: IntentSpec: 2
+! CHECK-NEXT: IntentSpec::Intent: 2
+! CHECK-NEXT: InternalSubprogram: 2
+! CHECK-NEXT: ProcedureDesignator: 2
+! CHECK-NEXT: SpecificationConstruct: 2
+! CHECK-NEXT: TypeDeclarationStmt: 2
+! CHECK-NEXT: AssignmentStmt: 1
+! CHECK-NEXT: CallStmt: 1
+! CHECK-NEXT: CharLiteralConstant: 1
+! CHECK-NEXT: ContainsStmt: 1
+! CHECK-NEXT: EndFunctionStmt: 1
+! CHECK-NEXT: EndProgramStmt: 1
+! CHECK-NEXT: EndSubroutineStmt: 1
+! CHECK-NEXT: Expr::Add: 1
+! CHECK-NEXT: Expr::Multiply: 1
+! CHECK-NEXT: Format: 1
+! CHECK-NEXT: FunctionReference: 1
+! CHECK-NEXT: FunctionStmt: 1
+! CHECK-NEXT: FunctionSubprogram: 1
+! CHECK-NEXT: ImplicitPartStmt: 1
+! CHECK-NEXT: ImplicitStmt: 1
+! CHECK-NEXT: InternalSubprogramPart: 1
+! CHECK-NEXT: MainProgram: 1
+! CHECK-NEXT: OutputItem: 1
+! CHECK-NEXT: PrefixSpec: 1
+! CHECK-NEXT: PrintStmt: 1
+! CHECK-NEXT: Program: 1
+! CHECK-NEXT: ProgramStmt: 1
+! CHECK-NEXT: ProgramUnit: 1
+! CHECK-NEXT: SubroutineStmt: 1
+! CHECK-NEXT: SubroutineSubprogram: 1
+! CHECK-NEXT: Variable: 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%pluginext \
+! 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: DataRef: 11
+! CHECK-NEXT: Designator: 7
+! CHECK-NEXT: DeclarationTypeSpec: 6
+! CHECK-NEXT: Expr: 5
+! CHECK-NEXT: DeclarationConstruct: 4
+! CHECK-NEXT: EntityDecl: 4
+! CHECK-NEXT: IntrinsicTypeSpec: 4
+! CHECK-NEXT: SpecificationConstruct: 4
+! CHECK-NEXT: StructureComponent: 4
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: AssignmentStmt: 3
+! CHECK-NEXT: AttrSpec: 3
+! CHECK-NEXT: DummyArg: 3
+! CHECK-NEXT: ExecutableConstruct: 3
+! CHECK-NEXT: ExecutionPartConstruct: 3
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: IntentSpec: 3
+! CHECK-NEXT: IntentSpec::Intent: 3
+! CHECK-NEXT: SpecificationPart: 3
+! CHECK-NEXT: TypeDeclarationStmt: 3
+! CHECK-NEXT: Variable: 3
+! CHECK-NEXT: Block: 2
+! CHECK-NEXT: ComponentDecl: 2
+! CHECK-NEXT: ComponentDefStmt: 2
+! CHECK-NEXT: ComponentOrFill: 2
+! CHECK-NEXT: ContainsStmt: 2
+! CHECK-NEXT: DataComponentDefStmt: 2
+! CHECK-NEXT: DeclarationTypeSpec::C

[PATCH] D143704: [flang] Feature list plugin

2023-03-29 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough updated this revision to Diff 509395.

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/CMakeLists.txt
  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%pluginext \
+! 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: Expr: 11
+! CHECK-NEXT: DataRef: 5
+! CHECK-NEXT: Designator: 5
+! CHECK-NEXT: ActualArg: 4
+! CHECK-NEXT: ActualArgSpec: 4
+! CHECK-NEXT: EntityDecl: 4
+! CHECK-NEXT: LiteralConstant: 4
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: Block: 3
+! CHECK-NEXT: DeclarationTypeSpec: 3
+! CHECK-NEXT: ExecutableConstruct: 3
+! CHECK-NEXT: ExecutionPart: 3
+! CHECK-NEXT: ExecutionPartConstruct: 3
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: IntLiteralConstant: 3
+! CHECK-NEXT: IntegerTypeSpec: 3
+! CHECK-NEXT: IntrinsicTypeSpec: 3
+! CHECK-NEXT: SpecificationPart: 3
+! CHECK-NEXT: AttrSpec: 2
+! CHECK-NEXT: Call: 2
+! CHECK-NEXT: DeclarationConstruct: 2
+! CHECK-NEXT: DummyArg: 2
+! CHECK-NEXT: IntentSpec: 2
+! CHECK-NEXT: IntentSpec::Intent: 2
+! CHECK-NEXT: InternalSubprogram: 2
+! CHECK-NEXT: ProcedureDesignator: 2
+! CHECK-NEXT: SpecificationConstruct: 2
+! CHECK-NEXT: TypeDeclarationStmt: 2
+! CHECK-NEXT: AssignmentStmt: 1
+! CHECK-NEXT: CallStmt: 1
+! CHECK-NEXT: CharLiteralConstant: 1
+! CHECK-NEXT: ContainsStmt: 1
+! CHECK-NEXT: EndFunctionStmt: 1
+! CHECK-NEXT: EndProgramStmt: 1
+! CHECK-NEXT: EndSubroutineStmt: 1
+! CHECK-NEXT: Expr::Add: 1
+! CHECK-NEXT: Expr::Multiply: 1
+! CHECK-NEXT: Format: 1
+! CHECK-NEXT: FunctionReference: 1
+! CHECK-NEXT: FunctionStmt: 1
+! CHECK-NEXT: FunctionSubprogram: 1
+! CHECK-NEXT: ImplicitPartStmt: 1
+! CHECK-NEXT: ImplicitStmt: 1
+! CHECK-NEXT: InternalSubprogramPart: 1
+! CHECK-NEXT: MainProgram: 1
+! CHECK-NEXT: OutputItem: 1
+! CHECK-NEXT: PrefixSpec: 1
+! CHECK-NEXT: PrintStmt: 1
+! CHECK-NEXT: Program: 1
+! CHECK-NEXT: ProgramStmt: 1
+! CHECK-NEXT: ProgramUnit: 1
+! CHECK-NEXT: SubroutineStmt: 1
+! CHECK-NEXT: SubroutineSubprogram: 1
+! CHECK-NEXT: Variable: 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%pluginext \
+! 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: DataRef: 11
+! CHECK-NEXT: Designator: 7
+! CHECK-NEXT: DeclarationTypeSpec: 6
+! CHECK-NEXT: Expr: 5
+! CHECK-NEXT: DeclarationConstruct: 4
+! CHECK-NEXT: EntityDecl: 4
+! CHECK-NEXT: IntrinsicTypeSpec: 4
+! CHECK-NEXT: SpecificationConstruct: 4
+! CHECK-NEXT: StructureComponent: 4
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: AssignmentStmt: 3
+! CHECK-NEXT: AttrSpec: 3
+! CHECK-NEXT: DummyArg: 3
+! CHECK-NEXT: ExecutableConstruct: 3
+! CHECK-NEXT: ExecutionPartConstruct: 3
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: IntentSpec: 3
+! CHECK-NEXT: IntentSpec::Intent: 3
+! CHECK-NEXT: SpecificationPart: 3
+! CHECK-NEXT: TypeDeclarationStmt: 3
+! CHECK-NEXT: Variable: 3
+! CHECK-NEXT: Block: 2
+! CHECK-NEXT: ComponentDecl: 2
+! CHECK-NEXT: ComponentDefStmt: 2
+! CHECK-NEXT: ComponentOrFill: 2
+! CHECK-NEXT: ContainsStmt: 2
+! CHECK-NEXT: DataComponentDefStmt: 2
+! CHECK-NEXT: DeclarationTypeSpec::Class: 2
+! CHECK-NEXT: DerivedTypeS

[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-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-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] Feature list plugin

2023-04-03 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough updated this revision to Diff 510553.

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/CMakeLists.txt
  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%pluginext \
+! 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: Expr: 11
+! CHECK-NEXT: DataRef: 5
+! CHECK-NEXT: Designator: 5
+! CHECK-NEXT: ActualArg: 4
+! CHECK-NEXT: ActualArgSpec: 4
+! CHECK-NEXT: EntityDecl: 4
+! CHECK-NEXT: LiteralConstant: 4
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: Block: 3
+! CHECK-NEXT: DeclarationTypeSpec: 3
+! CHECK-NEXT: ExecutableConstruct: 3
+! CHECK-NEXT: ExecutionPart: 3
+! CHECK-NEXT: ExecutionPartConstruct: 3
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: IntLiteralConstant: 3
+! CHECK-NEXT: IntegerTypeSpec: 3
+! CHECK-NEXT: IntrinsicTypeSpec: 3
+! CHECK-NEXT: SpecificationPart: 3
+! CHECK-NEXT: AttrSpec: 2
+! CHECK-NEXT: Call: 2
+! CHECK-NEXT: DeclarationConstruct: 2
+! CHECK-NEXT: DummyArg: 2
+! CHECK-NEXT: IntentSpec: 2
+! CHECK-NEXT: IntentSpec::Intent: 2
+! CHECK-NEXT: InternalSubprogram: 2
+! CHECK-NEXT: ProcedureDesignator: 2
+! CHECK-NEXT: SpecificationConstruct: 2
+! CHECK-NEXT: TypeDeclarationStmt: 2
+! CHECK-NEXT: AssignmentStmt: 1
+! CHECK-NEXT: CallStmt: 1
+! CHECK-NEXT: CharLiteralConstant: 1
+! CHECK-NEXT: ContainsStmt: 1
+! CHECK-NEXT: EndFunctionStmt: 1
+! CHECK-NEXT: EndProgramStmt: 1
+! CHECK-NEXT: EndSubroutineStmt: 1
+! CHECK-NEXT: Expr::Add: 1
+! CHECK-NEXT: Expr::Multiply: 1
+! CHECK-NEXT: Format: 1
+! CHECK-NEXT: FunctionReference: 1
+! CHECK-NEXT: FunctionStmt: 1
+! CHECK-NEXT: FunctionSubprogram: 1
+! CHECK-NEXT: ImplicitPartStmt: 1
+! CHECK-NEXT: ImplicitStmt: 1
+! CHECK-NEXT: InternalSubprogramPart: 1
+! CHECK-NEXT: MainProgram: 1
+! CHECK-NEXT: OutputItem: 1
+! CHECK-NEXT: PrefixSpec: 1
+! CHECK-NEXT: PrintStmt: 1
+! CHECK-NEXT: Program: 1
+! CHECK-NEXT: ProgramStmt: 1
+! CHECK-NEXT: ProgramUnit: 1
+! CHECK-NEXT: SubroutineStmt: 1
+! CHECK-NEXT: SubroutineSubprogram: 1
+! CHECK-NEXT: Variable: 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%pluginext \
+! 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: DataRef: 11
+! CHECK-NEXT: Designator: 7
+! CHECK-NEXT: DeclarationTypeSpec: 6
+! CHECK-NEXT: Expr: 5
+! CHECK-NEXT: DeclarationConstruct: 4
+! CHECK-NEXT: EntityDecl: 4
+! CHECK-NEXT: IntrinsicTypeSpec: 4
+! CHECK-NEXT: SpecificationConstruct: 4
+! CHECK-NEXT: StructureComponent: 4
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: AssignmentStmt: 3
+! CHECK-NEXT: AttrSpec: 3
+! CHECK-NEXT: DummyArg: 3
+! CHECK-NEXT: ExecutableConstruct: 3
+! CHECK-NEXT: ExecutionPartConstruct: 3
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: IntentSpec: 3
+! CHECK-NEXT: IntentSpec::Intent: 3
+! CHECK-NEXT: SpecificationPart: 3
+! CHECK-NEXT: TypeDeclarationStmt: 3
+! CHECK-NEXT: Variable: 3
+! CHECK-NEXT: Block: 2
+! CHECK-NEXT: ComponentDecl: 2
+! CHECK-NEXT: ComponentDefStmt: 2
+! CHECK-NEXT: ComponentOrFill: 2
+! CHECK-NEXT: ContainsStmt: 2
+! CHECK-NEXT: DataComponentDefStmt: 2
+! CHECK-NEXT: DeclarationTypeSpec::Class: 2
+! CHECK-NEXT: DerivedTypeS

[PATCH] D143704: [flang] Feature list plugin

2023-04-06 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough updated this revision to Diff 511537.

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/CMakeLists.txt
  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%pluginext \
+! 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: Expr: 11
+! CHECK-NEXT: DataRef: 5
+! CHECK-NEXT: Designator: 5
+! CHECK-NEXT: ActualArg: 4
+! CHECK-NEXT: ActualArgSpec: 4
+! CHECK-NEXT: EntityDecl: 4
+! CHECK-NEXT: LiteralConstant: 4
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: Block: 3
+! CHECK-NEXT: DeclarationTypeSpec: 3
+! CHECK-NEXT: ExecutableConstruct: 3
+! CHECK-NEXT: ExecutionPart: 3
+! CHECK-NEXT: ExecutionPartConstruct: 3
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: IntLiteralConstant: 3
+! CHECK-NEXT: IntegerTypeSpec: 3
+! CHECK-NEXT: IntrinsicTypeSpec: 3
+! CHECK-NEXT: SpecificationPart: 3
+! CHECK-NEXT: AttrSpec: 2
+! CHECK-NEXT: Call: 2
+! CHECK-NEXT: DeclarationConstruct: 2
+! CHECK-NEXT: DummyArg: 2
+! CHECK-NEXT: IntentSpec: 2
+! CHECK-NEXT: IntentSpec::Intent: 2
+! CHECK-NEXT: InternalSubprogram: 2
+! CHECK-NEXT: ProcedureDesignator: 2
+! CHECK-NEXT: SpecificationConstruct: 2
+! CHECK-NEXT: TypeDeclarationStmt: 2
+! CHECK-NEXT: AssignmentStmt: 1
+! CHECK-NEXT: CallStmt: 1
+! CHECK-NEXT: CharLiteralConstant: 1
+! CHECK-NEXT: ContainsStmt: 1
+! CHECK-NEXT: EndFunctionStmt: 1
+! CHECK-NEXT: EndProgramStmt: 1
+! CHECK-NEXT: EndSubroutineStmt: 1
+! CHECK-NEXT: Expr::Add: 1
+! CHECK-NEXT: Expr::Multiply: 1
+! CHECK-NEXT: Format: 1
+! CHECK-NEXT: FunctionReference: 1
+! CHECK-NEXT: FunctionStmt: 1
+! CHECK-NEXT: FunctionSubprogram: 1
+! CHECK-NEXT: ImplicitPartStmt: 1
+! CHECK-NEXT: ImplicitStmt: 1
+! CHECK-NEXT: InternalSubprogramPart: 1
+! CHECK-NEXT: MainProgram: 1
+! CHECK-NEXT: OutputItem: 1
+! CHECK-NEXT: PrefixSpec: 1
+! CHECK-NEXT: PrintStmt: 1
+! CHECK-NEXT: Program: 1
+! CHECK-NEXT: ProgramStmt: 1
+! CHECK-NEXT: ProgramUnit: 1
+! CHECK-NEXT: SubroutineStmt: 1
+! CHECK-NEXT: SubroutineSubprogram: 1
+! CHECK-NEXT: Variable: 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%pluginext \
+! 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: DataRef: 11
+! CHECK-NEXT: Designator: 7
+! CHECK-NEXT: DeclarationTypeSpec: 6
+! CHECK-NEXT: Expr: 5
+! CHECK-NEXT: DeclarationConstruct: 4
+! CHECK-NEXT: EntityDecl: 4
+! CHECK-NEXT: IntrinsicTypeSpec: 4
+! CHECK-NEXT: SpecificationConstruct: 4
+! CHECK-NEXT: StructureComponent: 4
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: AssignmentStmt: 3
+! CHECK-NEXT: AttrSpec: 3
+! CHECK-NEXT: DummyArg: 3
+! CHECK-NEXT: ExecutableConstruct: 3
+! CHECK-NEXT: ExecutionPartConstruct: 3
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: IntentSpec: 3
+! CHECK-NEXT: IntentSpec::Intent: 3
+! CHECK-NEXT: SpecificationPart: 3
+! CHECK-NEXT: TypeDeclarationStmt: 3
+! CHECK-NEXT: Variable: 3
+! CHECK-NEXT: Block: 2
+! CHECK-NEXT: ComponentDecl: 2
+! CHECK-NEXT: ComponentDefStmt: 2
+! CHECK-NEXT: ComponentOrFill: 2
+! CHECK-NEXT: ContainsStmt: 2
+! CHECK-NEXT: DataComponentDefStmt: 2
+! CHECK-NEXT: DeclarationTypeSpec::Class: 2
+! CHECK-NEXT: DerivedTypeS

[PATCH] D143301: Emit warning for unsupported gfortran flags

2023-02-11 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough updated this revision to Diff 496730.
elmcdonough retitled this revision from "Emit warning for `-Wextra` instead of 
error" to "Emit warning for unsupported gfortran flags".
elmcdonough added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This update adds other unsupported gfortran options to Options.td.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143301

Files:
  clang/include/clang/Driver/Options.td
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/test/Driver/werror-all.f90
  flang/test/Driver/wextra-ok.f90

Index: flang/test/Driver/wextra-ok.f90
===
--- /dev/null
+++ flang/test/Driver/wextra-ok.f90
@@ -0,0 +1,11 @@
+! Ensure that supplying -Wextra into flang-new does not raise error
+! The first check should be changed if -Wextra is implemented
+
+! RUN: %flang -std=f2018 -Wextra %s 2>&1 | FileCheck %s --check-prefix=CHECK-OK
+! RUN: not %flang -std=f2018 -Wblah -Wextra %s 2>&1 | FileCheck %s --check-prefix=WRONG
+
+! CHECK-OK: argument unused during compilation: '-Wextra'
+! WRONG: Only `-Werror` is supported currently.
+
+program wextra_ok
+end program wextra_ok
Index: flang/test/Driver/werror-all.f90
===
--- /dev/null
+++ flang/test/Driver/werror-all.f90
@@ -0,0 +1,13 @@
+! Ensures that -Werror is read regardless of whether or not other -W
+! flags are present in the CLI args
+
+! RUN: not %flang -std=f2018 -Werror -Wextra %s 2>&1 | FileCheck %s --check-prefix=WRONG 
+! RUN: %flang -std=f2018 -Wextra -Wall %s 2>&1 | FileCheck %s --check-prefix=CHECK-OK
+
+! WRONG: Semantic errors in
+! CHECK-OK: FORALL index variable
+
+program werror_check_all
+  integer :: a(3)
+  forall (j=1:n) a(i) = 1
+end program werror_check_all
Index: flang/lib/Frontend/CompilerInvocation.cpp
===
--- flang/lib/Frontend/CompilerInvocation.cpp
+++ flang/lib/Frontend/CompilerInvocation.cpp
@@ -604,14 +604,18 @@
   // TODO: Currently throws a Diagnostic for anything other than -W,
   // this has to change when other -W's are supported.
   if (args.hasArg(clang::driver::options::OPT_W_Joined)) {
-if (args.getLastArgValue(clang::driver::options::OPT_W_Joined)
-.equals("error")) {
-  res.setWarnAsErr(true);
-} else {
-  const unsigned diagID =
-  diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
-"Only `-Werror` is supported currently.");
-  diags.Report(diagID);
+const auto wArgs =
+args.getAllArgValues(clang::driver::options::OPT_W_Joined);
+for (const auto &wArg : wArgs) {
+  if (wArg == "error") {
+res.setWarnAsErr(true);
+  } else {
+const unsigned diagID =
+diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
+  "Only `-Werror` is supported currently.");
+diags.Report(diagID);
+break;
+  }
 }
   }
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -4988,6 +4988,8 @@
 defm aggressive_function_elimination : BooleanFFlag<"aggressive-function-elimination">, Group;
 defm align_commons : BooleanFFlag<"align-commons">, Group;
 defm all_intrinsics : BooleanFFlag<"all-intrinsics">, Group;
+defm allow_argument_mismatch : BooleanFFlag<"allow-argument-mismatch">, Group;
+defm allow_invalid_boz : BooleanFFlag<"allow-invalid-boz">, Group;
 def fautomatic : Flag<["-"], "fautomatic">; // -fno-automatic is significant
 defm backtrace : BooleanFFlag<"backtrace">, Group;
 defm bounds_check : BooleanFFlag<"bounds-check">, Group;
@@ -4995,6 +4997,17 @@
 defm cray_pointer : BooleanFFlag<"cray-pointer">, Group;
 defm d_lines_as_code : BooleanFFlag<"d-lines-as-code">, Group;
 defm d_lines_as_comments : BooleanFFlag<"d-lines-as-comments">, Group;
+defm dec : BooleanFFlag<"dec">, Group;
+defm dec_char_conversions : BooleanFFlag<"dec-char-conversions">, Group;
+defm dec_structure : BooleanFFlag<"dec-structure">, Group;
+defm dec_intrinsic_ints : BooleanFFlag<"dec-intrinsic-ints">, Group;
+defm dec_static : BooleanFFlag<"dec-static">, Group;
+defm dec_math : BooleanFFlag<"dec-math">, Group;
+defm dec_include : BooleanFFlag<"dec-include">, Group;
+defm dec_format_defaults : BooleanFFlag<"dec-format-defaults">, Group;
+defm dec_blank_format_item : BooleanFFlag<"dec-blank-format-item">, Group;
+defm default_real_10 : BooleanFFlag<"default-real-10">, Group;
+defm default_real_16 : BooleanFFlag<"default-real-16">, Group;
 defm dollar_ok : BooleanFFlag<"dollar-ok">, Group;
 defm dump_fortran_optimized : BooleanFFlag<"dump-fortran-optimized">, Group;
 defm dump_fortran_original : BooleanFFlag<"dump-for

[PATCH] D143301: Emit warning for unsupported gfortran flags

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

Thanks for the feedback everyone.  This is my current understanding on what I 
should do: I am to rename gfortran_unsupported_Group to flang_ignored_w_Group 
and move the non W group gfortran options into another patch.  I have these 
changes locally and am currently building + testing.  Please let me know if I'm 
misinterpreting these instructions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143301

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


[PATCH] D143301: [flang] Handle unsupported warning flags

2023-02-14 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough updated this revision to Diff 497405.
elmcdonough retitled this revision from "Emit warning for unsupported gfortran 
flags" to "[flang] Handle unsupported warning flags".
elmcdonough edited the summary of this revision.
Herald added a subscriber: sunshaoce.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143301

Files:
  clang/include/clang/Driver/Options.td
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/test/Driver/werror-all.f90
  flang/test/Driver/wextra-ok.f90

Index: flang/test/Driver/wextra-ok.f90
===
--- /dev/null
+++ flang/test/Driver/wextra-ok.f90
@@ -0,0 +1,11 @@
+! Ensure that supplying -Wextra into flang-new does not raise error
+! The first check should be changed if -Wextra is implemented
+
+! RUN: %flang -std=f2018 -Wextra %s 2>&1 | FileCheck %s --check-prefix=CHECK-OK
+! RUN: not %flang -std=f2018 -Wblah -Wextra %s 2>&1 | FileCheck %s --check-prefix=WRONG
+
+! CHECK-OK: argument unused during compilation: '-Wextra'
+! WRONG: Only `-Werror` is supported currently.
+
+program wextra_ok
+end program wextra_ok
Index: flang/test/Driver/werror-all.f90
===
--- /dev/null
+++ flang/test/Driver/werror-all.f90
@@ -0,0 +1,13 @@
+! Ensures that -Werror is read regardless of whether or not other -W
+! flags are present in the CLI args
+
+! RUN: not %flang -std=f2018 -Werror -Wextra %s 2>&1 | FileCheck %s --check-prefix=WRONG 
+! RUN: %flang -std=f2018 -Wextra -Wall %s 2>&1 | FileCheck %s --check-prefix=CHECK-OK
+
+! WRONG: Semantic errors in
+! CHECK-OK: FORALL index variable
+
+program werror_check_all
+  integer :: a(3)
+  forall (j=1:n) a(i) = 1
+end program werror_check_all
Index: flang/lib/Frontend/CompilerInvocation.cpp
===
--- flang/lib/Frontend/CompilerInvocation.cpp
+++ flang/lib/Frontend/CompilerInvocation.cpp
@@ -604,14 +604,17 @@
   // TODO: Currently throws a Diagnostic for anything other than -W,
   // this has to change when other -W's are supported.
   if (args.hasArg(clang::driver::options::OPT_W_Joined)) {
-if (args.getLastArgValue(clang::driver::options::OPT_W_Joined)
-.equals("error")) {
-  res.setWarnAsErr(true);
-} else {
-  const unsigned diagID =
-  diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
-"Only `-Werror` is supported currently.");
-  diags.Report(diagID);
+const auto &wArgs =
+args.getAllArgValues(clang::driver::options::OPT_W_Joined);
+for (const auto &wArg : wArgs) {
+  if (wArg == "error") {
+res.setWarnAsErr(true);
+  } else {
+const unsigned diagID =
+diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
+  "Only `-Werror` is supported currently.");
+diags.Report(diagID);
+  }
 }
   }
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -235,6 +235,10 @@
 def clang_ignored_m_Group : OptionGroup<"">,
   Group, Flags<[Ignored]>;
 
+// Unsupported flang groups
+def flang_ignored_w_Group : OptionGroup<"">,
+  Group, Flags<[FlangOnlyOption, Ignored]>;
+
 // Group for clang options in the process of deprecation.
 // Please include the version that deprecated the flag as comment to allow
 // easier garbage collection.
@@ -4874,6 +4878,10 @@
   def fno_#NAME : Flag<["-"], "fno-"#name>;
 }
 
+multiclass FlangIgnoredWarning {
+  def unsupported_warning_w#NAME : Flag<["-", "--"], "W"#name>, Group;
+}
+
 defm : BooleanFFlag<"keep-inline-functions">, Group;
 
 def fprofile_dir : Joined<["-"], "fprofile-dir=">, Group;
@@ -5034,6 +5042,34 @@
 defm underscoring : BooleanFFlag<"underscoring">, Group;
 defm whole_file : BooleanFFlag<"whole-file">, Group;
 
+//
+defm : FlangIgnoredWarning<"extra">;
+defm : FlangIgnoredWarning<"aliasing">;
+defm : FlangIgnoredWarning<"ampersand">;
+defm : FlangIgnoredWarning<"array-bounds">;
+defm : FlangIgnoredWarning<"c-binding-type">;
+defm : FlangIgnoredWarning<"character-truncation">;
+defm : FlangIgnoredWarning<"conversion">;
+defm : FlangIgnoredWarning<"do-subscript">;
+defm : FlangIgnoredWarning<"function-elimination">;
+defm : FlangIgnoredWarning<"implicit-interface">;
+defm : FlangIgnoredWarning<"implicit-procedure">;
+defm : FlangIgnoredWarning<"intrinsic-shadow">;
+defm : FlangIgnoredWarning<"use-without-only">;
+defm : FlangIgnoredWarning<"intrinsics-std">;
+defm : FlangIgnoredWarning<"line-truncation">;
+defm : FlangIgnoredWarning<"no-align-commons">;
+defm : FlangIgnoredWarning<"no-overwrite-recursive">;
+defm : FlangIgnoredWarning<"no-tabs">;
+defm : FlangIgnoredWarning<"real-q-constant">;
+defm : FlangIgnoredWarning<"surpris

[PATCH] D143301: [flang] Handle unsupported warning flags

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

Change multiclass name for the sake of clarity.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143301

Files:
  clang/include/clang/Driver/Options.td
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/test/Driver/werror-all.f90
  flang/test/Driver/wextra-ok.f90

Index: flang/test/Driver/wextra-ok.f90
===
--- /dev/null
+++ flang/test/Driver/wextra-ok.f90
@@ -0,0 +1,11 @@
+! Ensure that supplying -Wextra into flang-new does not raise error
+! The first check should be changed if -Wextra is implemented
+
+! RUN: %flang -std=f2018 -Wextra %s 2>&1 | FileCheck %s --check-prefix=CHECK-OK
+! RUN: not %flang -std=f2018 -Wblah -Wextra %s 2>&1 | FileCheck %s --check-prefix=WRONG
+
+! CHECK-OK: argument unused during compilation: '-Wextra'
+! WRONG: Only `-Werror` is supported currently.
+
+program wextra_ok
+end program wextra_ok
Index: flang/test/Driver/werror-all.f90
===
--- /dev/null
+++ flang/test/Driver/werror-all.f90
@@ -0,0 +1,13 @@
+! Ensures that -Werror is read regardless of whether or not other -W
+! flags are present in the CLI args
+
+! RUN: not %flang -std=f2018 -Werror -Wextra %s 2>&1 | FileCheck %s --check-prefix=WRONG 
+! RUN: %flang -std=f2018 -Wextra -Wall %s 2>&1 | FileCheck %s --check-prefix=CHECK-OK
+
+! WRONG: Semantic errors in
+! CHECK-OK: FORALL index variable
+
+program werror_check_all
+  integer :: a(3)
+  forall (j=1:n) a(i) = 1
+end program werror_check_all
Index: flang/lib/Frontend/CompilerInvocation.cpp
===
--- flang/lib/Frontend/CompilerInvocation.cpp
+++ flang/lib/Frontend/CompilerInvocation.cpp
@@ -604,14 +604,17 @@
   // TODO: Currently throws a Diagnostic for anything other than -W,
   // this has to change when other -W's are supported.
   if (args.hasArg(clang::driver::options::OPT_W_Joined)) {
-if (args.getLastArgValue(clang::driver::options::OPT_W_Joined)
-.equals("error")) {
-  res.setWarnAsErr(true);
-} else {
-  const unsigned diagID =
-  diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
-"Only `-Werror` is supported currently.");
-  diags.Report(diagID);
+const auto &wArgs =
+args.getAllArgValues(clang::driver::options::OPT_W_Joined);
+for (const auto &wArg : wArgs) {
+  if (wArg == "error") {
+res.setWarnAsErr(true);
+  } else {
+const unsigned diagID =
+diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
+  "Only `-Werror` is supported currently.");
+diags.Report(diagID);
+  }
 }
   }
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -235,6 +235,10 @@
 def clang_ignored_m_Group : OptionGroup<"">,
   Group, Flags<[Ignored]>;
 
+// Unsupported flang groups
+def flang_ignored_w_Group : OptionGroup<"">,
+  Group, Flags<[FlangOnlyOption, Ignored]>;
+
 // Group for clang options in the process of deprecation.
 // Please include the version that deprecated the flag as comment to allow
 // easier garbage collection.
@@ -4874,6 +4878,10 @@
   def fno_#NAME : Flag<["-"], "fno-"#name>;
 }
 
+multiclass FlangIgnoredDiagOpt {
+  def unsupported_warning_w#NAME : Flag<["-", "--"], "W"#name>, Group;
+}
+
 defm : BooleanFFlag<"keep-inline-functions">, Group;
 
 def fprofile_dir : Joined<["-"], "fprofile-dir=">, Group;
@@ -5034,6 +5042,34 @@
 defm underscoring : BooleanFFlag<"underscoring">, Group;
 defm whole_file : BooleanFFlag<"whole-file">, Group;
 
+// Unsupported flang W options
+defm : FlangIgnoredDiagOpt<"extra">;
+defm : FlangIgnoredDiagOpt<"aliasing">;
+defm : FlangIgnoredDiagOpt<"ampersand">;
+defm : FlangIgnoredDiagOpt<"array-bounds">;
+defm : FlangIgnoredDiagOpt<"c-binding-type">;
+defm : FlangIgnoredDiagOpt<"character-truncation">;
+defm : FlangIgnoredDiagOpt<"conversion">;
+defm : FlangIgnoredDiagOpt<"do-subscript">;
+defm : FlangIgnoredDiagOpt<"function-elimination">;
+defm : FlangIgnoredDiagOpt<"implicit-interface">;
+defm : FlangIgnoredDiagOpt<"implicit-procedure">;
+defm : FlangIgnoredDiagOpt<"intrinsic-shadow">;
+defm : FlangIgnoredDiagOpt<"use-without-only">;
+defm : FlangIgnoredDiagOpt<"intrinsics-std">;
+defm : FlangIgnoredDiagOpt<"line-truncation">;
+defm : FlangIgnoredDiagOpt<"no-align-commons">;
+defm : FlangIgnoredDiagOpt<"no-overwrite-recursive">;
+defm : FlangIgnoredDiagOpt<"no-tabs">;
+defm : FlangIgnoredDiagOpt<"real-q-constant">;
+defm : FlangIgnoredDiagOpt<"surprising">;
+defm : FlangIgnoredDiagOpt<"underflow">;
+defm : FlangIgnoredDiagOpt<"unused-parameter">;
+defm : FlangIgn

[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] D143301: [flang] Handle unsupported warning flags

2023-02-17 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough updated this revision to Diff 498511.
elmcdonough marked an inline comment as done.
Herald added a subscriber: MaskRay.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143301

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Flang.cpp
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/test/Driver/werror-all.f90
  flang/test/Driver/wextra-ok.f90

Index: flang/test/Driver/wextra-ok.f90
===
--- /dev/null
+++ flang/test/Driver/wextra-ok.f90
@@ -0,0 +1,11 @@
+! Ensure that supplying -Wextra into flang-new does not raise error
+! The first check should be changed if -Wextra is implemented
+
+! RUN: %flang -std=f2018 -Wextra %s 2>&1 | FileCheck %s --check-prefix=CHECK-OK
+! RUN: not %flang -std=f2018 -Wblah -Wextra %s 2>&1 | FileCheck %s --check-prefix=WRONG
+
+! CHECK-OK: The warning option '-Wextra' is not supported
+! WRONG: Only `-Werror` is supported currently.
+
+program wextra_ok
+end program wextra_ok
Index: flang/test/Driver/werror-all.f90
===
--- /dev/null
+++ flang/test/Driver/werror-all.f90
@@ -0,0 +1,13 @@
+! Ensures that -Werror is read regardless of whether or not other -W
+! flags are present in the CLI args
+
+! RUN: not %flang -std=f2018 -Werror -Wextra %s 2>&1 | FileCheck %s --check-prefix=WRONG 
+! RUN: %flang -std=f2018 -Wextra -Wall %s 2>&1 | FileCheck %s --check-prefix=CHECK-OK
+
+! WRONG: Semantic errors in
+! CHECK-OK: FORALL index variable
+
+program werror_check_all
+  integer :: a(3)
+  forall (j=1:n) a(i) = 1
+end program werror_check_all
Index: flang/lib/Frontend/CompilerInvocation.cpp
===
--- flang/lib/Frontend/CompilerInvocation.cpp
+++ flang/lib/Frontend/CompilerInvocation.cpp
@@ -604,14 +604,17 @@
   // TODO: Currently throws a Diagnostic for anything other than -W,
   // this has to change when other -W's are supported.
   if (args.hasArg(clang::driver::options::OPT_W_Joined)) {
-if (args.getLastArgValue(clang::driver::options::OPT_W_Joined)
-.equals("error")) {
-  res.setWarnAsErr(true);
-} else {
-  const unsigned diagID =
-  diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
-"Only `-Werror` is supported currently.");
-  diags.Report(diagID);
+const auto &wArgs =
+args.getAllArgValues(clang::driver::options::OPT_W_Joined);
+for (const auto &wArg : wArgs) {
+  if (wArg == "error") {
+res.setWarnAsErr(true);
+  } else {
+const unsigned diagID =
+diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
+  "Only `-Werror` is supported currently.");
+diags.Report(diagID);
+  }
 }
   }
 
Index: clang/lib/Driver/ToolChains/Flang.cpp
===
--- clang/lib/Driver/ToolChains/Flang.cpp
+++ clang/lib/Driver/ToolChains/Flang.cpp
@@ -328,6 +328,12 @@
 A->render(Args, CmdArgs);
   }
 
+  // Remove any unsupported gfortran diagnostic options
+  for (const Arg *A : Args.filtered(options::OPT_flang_ignored_w_Group)) {
+A->claim();
+D.Diag(diag::warn_drv_unsupported_diag_option_for_flang) << A->getOption().getName();
+  }
+
   // Optimization level for CodeGen.
   if (const Arg *A = Args.getLastArg(options::OPT_O_Group)) {
 if (A->getOption().matches(options::OPT_O4)) {
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -235,6 +235,10 @@
 def clang_ignored_m_Group : OptionGroup<"">,
   Group, Flags<[Ignored]>;
 
+// Unsupported flang groups
+def flang_ignored_w_Group : OptionGroup<"">,
+  Group, Flags<[FlangOnlyOption, Ignored]>;
+
 // Group for clang options in the process of deprecation.
 // Please include the version that deprecated the flag as comment to allow
 // easier garbage collection.
@@ -4874,6 +4878,10 @@
   def fno_#NAME : Flag<["-"], "fno-"#name>;
 }
 
+multiclass FlangIgnoredDiagOpt {
+  def unsupported_warning_w#NAME : Flag<["-", "--"], "W"#name>, Group;
+}
+
 defm : BooleanFFlag<"keep-inline-functions">, Group;
 
 def fprofile_dir : Joined<["-"], "fprofile-dir=">, Group;
@@ -5034,6 +5042,34 @@
 defm underscoring : BooleanFFlag<"underscoring">, Group;
 defm whole_file : BooleanFFlag<"whole-file">, Group;
 
+// Unsupported flang W options
+defm : FlangIgnoredDiagOpt<"extra">;
+defm : FlangIgnoredDiagOpt<"aliasing">;
+defm : FlangIgnoredDiagOpt<"ampersand">;
+defm : FlangIgnoredDiagOpt<"array-bounds">;
+defm : FlangIgnoredDiagOpt<"c-binding-type">;
+defm : FlangIgnoredDiagOpt<"character-truncation">;
+defm : FlangIgnoredDiagO

[PATCH] D143301: [flang] Handle unsupported warning flags

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

In D143301#4135301 , @awarzynski 
wrote:

> @elmcdonough , let me rephrase this (should've been clearer before, sorry):
>
>> One thing that's not clear to me - how come "-Wextra" is not treated as an 
>> error and "-Wblah" is?
>
> Where's the logic that makes sure that `-Wextra` (and other flags that you 
> redefine here) is reported as unused? That's not clear from this definition:
>
>   multiclass FlangIgnoredDiagOpt {
> def unsupported_warning_w#NAME : Flag<["-", "--"], "W"#name>, 
> Group;
>   }
>
> In particular, I don't see anything that would check whether a particular 
> option is in this group: `flang_ignored_w_Group`.

I think I understand now.  I initially didn't add any manual handling to the PR 
because I found that defining the options but leaving them as `Ignored` caused 
an "argument unused during compilation" whenever they were used in my local 
tests.  This revision should give an explicit warning about the warning options 
not being supported.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143301

___
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] D143301: [flang] Handle unsupported warning flags

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

Clang format + documentation update


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143301

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Flang.cpp
  flang/docs/FlangDriver.md
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/test/Driver/werror-all.f90
  flang/test/Driver/wextra-ok.f90

Index: flang/test/Driver/wextra-ok.f90
===
--- /dev/null
+++ flang/test/Driver/wextra-ok.f90
@@ -0,0 +1,11 @@
+! Ensure that supplying -Wextra into flang-new does not raise error
+! The first check should be changed if -Wextra is implemented
+
+! RUN: %flang -std=f2018 -Wextra %s 2>&1 | FileCheck %s --check-prefix=CHECK-OK
+! RUN: not %flang -std=f2018 -Wblah -Wextra %s 2>&1 | FileCheck %s --check-prefix=WRONG
+
+! CHECK-OK: The warning option '-Wextra' is not supported
+! WRONG: Only `-Werror` is supported currently.
+
+program wextra_ok
+end program wextra_ok
Index: flang/test/Driver/werror-all.f90
===
--- /dev/null
+++ flang/test/Driver/werror-all.f90
@@ -0,0 +1,13 @@
+! Ensures that -Werror is read regardless of whether or not other -W
+! flags are present in the CLI args
+
+! RUN: not %flang -std=f2018 -Werror -Wextra %s 2>&1 | FileCheck %s --check-prefix=WRONG 
+! RUN: %flang -std=f2018 -Wextra -Wall %s 2>&1 | FileCheck %s --check-prefix=CHECK-OK
+
+! WRONG: Semantic errors in
+! CHECK-OK: FORALL index variable
+
+program werror_check_all
+  integer :: a(3)
+  forall (j=1:n) a(i) = 1
+end program werror_check_all
Index: flang/lib/Frontend/CompilerInvocation.cpp
===
--- flang/lib/Frontend/CompilerInvocation.cpp
+++ flang/lib/Frontend/CompilerInvocation.cpp
@@ -604,14 +604,17 @@
   // TODO: Currently throws a Diagnostic for anything other than -W,
   // this has to change when other -W's are supported.
   if (args.hasArg(clang::driver::options::OPT_W_Joined)) {
-if (args.getLastArgValue(clang::driver::options::OPT_W_Joined)
-.equals("error")) {
-  res.setWarnAsErr(true);
-} else {
-  const unsigned diagID =
-  diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
-"Only `-Werror` is supported currently.");
-  diags.Report(diagID);
+const auto &wArgs =
+args.getAllArgValues(clang::driver::options::OPT_W_Joined);
+for (const auto &wArg : wArgs) {
+  if (wArg == "error") {
+res.setWarnAsErr(true);
+  } else {
+const unsigned diagID =
+diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
+  "Only `-Werror` is supported currently.");
+diags.Report(diagID);
+  }
 }
   }
 
Index: flang/docs/FlangDriver.md
===
--- flang/docs/FlangDriver.md
+++ flang/docs/FlangDriver.md
@@ -581,6 +581,10 @@
 GCC/GFortran will also set flush-to-zero mode: linking `crtfastmath.o`, the same
 as Flang.
 
+The only GCC/GFortran warning option currently supported is `-Werror`.  Passing
+any unsupported GCC/GFortran warning flags into Flang's compiler driver will
+result in warnings being emitted.
+
 ### Comparison with nvfortran
 nvfortran defines `-fast` as
 `-O2 -Munroll=c:1 -Mnoframe -Mlre -Mpre -Mvect=simd -Mcache_align -Mflushz -Mvect`.
Index: clang/lib/Driver/ToolChains/Flang.cpp
===
--- clang/lib/Driver/ToolChains/Flang.cpp
+++ clang/lib/Driver/ToolChains/Flang.cpp
@@ -328,6 +328,13 @@
 A->render(Args, CmdArgs);
   }
 
+  // Remove any unsupported gfortran diagnostic options
+  for (const Arg *A : Args.filtered(options::OPT_flang_ignored_w_Group)) {
+A->claim();
+D.Diag(diag::warn_drv_unsupported_diag_option_for_flang)
+<< A->getOption().getName();
+  }
+
   // Optimization level for CodeGen.
   if (const Arg *A = Args.getLastArg(options::OPT_O_Group)) {
 if (A->getOption().matches(options::OPT_O4)) {
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -235,6 +235,10 @@
 def clang_ignored_m_Group : OptionGroup<"">,
   Group, Flags<[Ignored]>;
 
+// Unsupported flang groups
+def flang_ignored_w_Group : OptionGroup<"">,
+  Group, Flags<[FlangOnlyOption, Ignored]>;
+
 // Group for clang options in the process of deprecation.
 // Please include the version that deprecated the flag as comment to allow
 // easier garbage collection.
@@ -4874,6 +4878,10 @@
   def fno_#NAME : Flag<["-"], "fno-"#name>;
 }
 
+multiclass FlangIgnoredDiagOpt {
+  def unsu

[PATCH] D143301: [flang] Handle unsupported warning flags

2023-02-21 Thread Ethan Luis McDonough via Phabricator via cfe-commits
elmcdonough updated this revision to Diff 499259.
elmcdonough marked 3 inline comments as done.
elmcdonough added a comment.

Comment edit + exhuastive testing


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143301

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Flang.cpp
  flang/docs/FlangDriver.md
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/test/Driver/w-arg-unsupported.f90
  flang/test/Driver/werror-all.f90
  flang/test/Driver/wextra-ok.f90

Index: flang/test/Driver/wextra-ok.f90
===
--- /dev/null
+++ flang/test/Driver/wextra-ok.f90
@@ -0,0 +1,11 @@
+! Ensure that supplying -Wextra into flang-new does not raise error
+! The first check should be changed if -Wextra is implemented
+
+! RUN: %flang -std=f2018 -Wextra %s 2>&1 | FileCheck %s --check-prefix=CHECK-OK
+! RUN: not %flang -std=f2018 -Wblah -Wextra %s 2>&1 | FileCheck %s --check-prefix=WRONG
+
+! CHECK-OK: The warning option '-Wextra' is not supported
+! WRONG: Only `-Werror` is supported currently.
+
+program wextra_ok
+end program wextra_ok
Index: flang/test/Driver/werror-all.f90
===
--- /dev/null
+++ flang/test/Driver/werror-all.f90
@@ -0,0 +1,13 @@
+! Ensures that -Werror is read regardless of whether or not other -W
+! flags are present in the CLI args
+
+! RUN: not %flang -std=f2018 -Werror -Wextra %s 2>&1 | FileCheck %s --check-prefix=WRONG
+! RUN: %flang -std=f2018 -Wextra -Wall %s 2>&1 | FileCheck %s --check-prefix=CHECK-OK
+
+! WRONG: Semantic errors in
+! CHECK-OK: FORALL index variable
+
+program werror_check_all
+  integer :: a(3)
+  forall (j=1:n) a(i) = 1
+end program werror_check_all
Index: flang/test/Driver/w-arg-unsupported.f90
===
--- /dev/null
+++ flang/test/Driver/w-arg-unsupported.f90
@@ -0,0 +1,37 @@
+! RUN: %flang -std=f2018 -Wextra -Waliasing -Wampersand -Warray-bounds -Wc-binding-type \
+! RUN:-Wcharacter-truncation -Wconversion -Wdo-subscript -Wfunction-elimination \
+! RUN:-Wimplicit-interface -Wimplicit-procedure -Wintrinsic-shadow -Wuse-without-only \
+! RUN:-Wintrinsics-std -Wline-truncation -Wno-align-commons -Wno-overwrite-recursive \
+! RUN:-Wno-tabs -Wreal-q-constant -Wsurprising -Wunderflow -Wunused-parameter \
+! RUN:-Wrealloc-lhs -Wrealloc-lhs-all -Wfrontend-loop-interchange -Wtarget-lifetime %s \
+! RUN:2>&1 | FileCheck %s
+
+! CHECK: The warning option '-Wextra' is not supported
+! CHECK-NEXT: The warning option '-Waliasing' is not supported
+! CHECK-NEXT: The warning option '-Wampersand' is not supported
+! CHECK-NEXT: The warning option '-Warray-bounds' is not supported
+! CHECK-NEXT: The warning option '-Wc-binding-type' is not supported
+! CHECK-NEXT: The warning option '-Wcharacter-truncation' is not supported
+! CHECK-NEXT: The warning option '-Wconversion' is not supported
+! CHECK-NEXT: The warning option '-Wdo-subscript' is not supported
+! CHECK-NEXT: The warning option '-Wfunction-elimination' is not supported
+! CHECK-NEXT: The warning option '-Wimplicit-interface' is not supported
+! CHECK-NEXT: The warning option '-Wimplicit-procedure' is not supported
+! CHECK-NEXT: The warning option '-Wintrinsic-shadow' is not supported
+! CHECK-NEXT: The warning option '-Wuse-without-only' is not supported
+! CHECK-NEXT: The warning option '-Wintrinsics-std' is not supported
+! CHECK-NEXT: The warning option '-Wline-truncation' is not supported
+! CHECK-NEXT: The warning option '-Wno-align-commons' is not supported
+! CHECK-NEXT: The warning option '-Wno-overwrite-recursive' is not supported
+! CHECK-NEXT: The warning option '-Wno-tabs' is not supported
+! CHECK-NEXT: The warning option '-Wreal-q-constant' is not supported
+! CHECK-NEXT: The warning option '-Wsurprising' is not supported
+! CHECK-NEXT: The warning option '-Wunderflow' is not supported
+! CHECK-NEXT: The warning option '-Wunused-parameter' is not supported
+! CHECK-NEXT: The warning option '-Wrealloc-lhs' is not supported
+! CHECK-NEXT: The warning option '-Wrealloc-lhs-all' is not supported
+! CHECK-NEXT: The warning option '-Wfrontend-loop-interchange' is not supported
+! CHECK-NEXT: The warning option '-Wtarget-lifetime' is not supported
+
+program m
+end program
Index: flang/lib/Frontend/CompilerInvocation.cpp
===
--- flang/lib/Frontend/CompilerInvocation.cpp
+++ flang/lib/Frontend/CompilerInvocation.cpp
@@ -604,14 +604,17 @@
   // TODO: Currently throws a Diagnostic for anything other than -W,
   // this has to change when other -W's are supported.
   if (args.hasArg(clang::driver::options::OPT_W_Joined)) {
-if (args.getLastArgValue(clang::driver::options::OPT_

[PATCH] D143301: [flang] Handle unsupported warning flags

2023-02-21 Thread Ethan Luis McDonough via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGce3a1c59e180: [flang] Handle unsupported warning flags 
(authored by elmcdonough).

Changed prior to commit:
  https://reviews.llvm.org/D143301?vs=499259&id=499295#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143301

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Flang.cpp
  flang/docs/FlangDriver.md
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/test/Driver/w-arg-unsupported.f90
  flang/test/Driver/werror-all.f90
  flang/test/Driver/wextra-ok.f90

Index: flang/test/Driver/wextra-ok.f90
===
--- /dev/null
+++ flang/test/Driver/wextra-ok.f90
@@ -0,0 +1,11 @@
+! Ensure that supplying -Wextra into flang-new does not raise error
+! The first check should be changed if -Wextra is implemented
+
+! RUN: %flang -std=f2018 -Wextra %s 2>&1 | FileCheck %s --check-prefix=CHECK-OK
+! RUN: not %flang -std=f2018 -Wblah -Wextra %s 2>&1 | FileCheck %s --check-prefix=WRONG
+
+! CHECK-OK: The warning option '-Wextra' is not supported
+! WRONG: Only `-Werror` is supported currently.
+
+program wextra_ok
+end program wextra_ok
Index: flang/test/Driver/werror-all.f90
===
--- /dev/null
+++ flang/test/Driver/werror-all.f90
@@ -0,0 +1,13 @@
+! Ensures that -Werror is read regardless of whether or not other -W
+! flags are present in the CLI args
+
+! RUN: not %flang -std=f2018 -Werror -Wextra %s 2>&1 | FileCheck %s --check-prefix=WRONG
+! RUN: %flang -std=f2018 -Wextra -Wall %s 2>&1 | FileCheck %s --check-prefix=CHECK-OK
+
+! WRONG: Semantic errors in
+! CHECK-OK: FORALL index variable
+
+program werror_check_all
+  integer :: a(3)
+  forall (j=1:n) a(i) = 1
+end program werror_check_all
Index: flang/test/Driver/w-arg-unsupported.f90
===
--- /dev/null
+++ flang/test/Driver/w-arg-unsupported.f90
@@ -0,0 +1,37 @@
+! RUN: %flang -std=f2018 -Wextra -Waliasing -Wampersand -Warray-bounds -Wc-binding-type \
+! RUN:-Wcharacter-truncation -Wconversion -Wdo-subscript -Wfunction-elimination \
+! RUN:-Wimplicit-interface -Wimplicit-procedure -Wintrinsic-shadow -Wuse-without-only \
+! RUN:-Wintrinsics-std -Wline-truncation -Wno-align-commons -Wno-overwrite-recursive \
+! RUN:-Wno-tabs -Wreal-q-constant -Wsurprising -Wunderflow -Wunused-parameter \
+! RUN:-Wrealloc-lhs -Wrealloc-lhs-all -Wfrontend-loop-interchange -Wtarget-lifetime %s \
+! RUN:2>&1 | FileCheck %s
+
+! CHECK: The warning option '-Wextra' is not supported
+! CHECK-NEXT: The warning option '-Waliasing' is not supported
+! CHECK-NEXT: The warning option '-Wampersand' is not supported
+! CHECK-NEXT: The warning option '-Warray-bounds' is not supported
+! CHECK-NEXT: The warning option '-Wc-binding-type' is not supported
+! CHECK-NEXT: The warning option '-Wcharacter-truncation' is not supported
+! CHECK-NEXT: The warning option '-Wconversion' is not supported
+! CHECK-NEXT: The warning option '-Wdo-subscript' is not supported
+! CHECK-NEXT: The warning option '-Wfunction-elimination' is not supported
+! CHECK-NEXT: The warning option '-Wimplicit-interface' is not supported
+! CHECK-NEXT: The warning option '-Wimplicit-procedure' is not supported
+! CHECK-NEXT: The warning option '-Wintrinsic-shadow' is not supported
+! CHECK-NEXT: The warning option '-Wuse-without-only' is not supported
+! CHECK-NEXT: The warning option '-Wintrinsics-std' is not supported
+! CHECK-NEXT: The warning option '-Wline-truncation' is not supported
+! CHECK-NEXT: The warning option '-Wno-align-commons' is not supported
+! CHECK-NEXT: The warning option '-Wno-overwrite-recursive' is not supported
+! CHECK-NEXT: The warning option '-Wno-tabs' is not supported
+! CHECK-NEXT: The warning option '-Wreal-q-constant' is not supported
+! CHECK-NEXT: The warning option '-Wsurprising' is not supported
+! CHECK-NEXT: The warning option '-Wunderflow' is not supported
+! CHECK-NEXT: The warning option '-Wunused-parameter' is not supported
+! CHECK-NEXT: The warning option '-Wrealloc-lhs' is not supported
+! CHECK-NEXT: The warning option '-Wrealloc-lhs-all' is not supported
+! CHECK-NEXT: The warning option '-Wfrontend-loop-interchange' is not supported
+! CHECK-NEXT: The warning option '-Wtarget-lifetime' is not supported
+
+program m
+end program
Index: flang/lib/Frontend/CompilerInvocation.cpp
===
--- flang/lib/Frontend/CompilerInvocation.cpp
+++ flang/lib/Frontend/CompilerInvocation.cpp
@@ -610,14 +610,17 @@
   // TODO: Currently throws a Diagnostic for anything other than -W,
   // this has to 

[PATCH] D143301: [flang] Handle unsupported warning flags

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

In D143301#4143241 , @PeteSteinfeld 
wrote:

> In D143301#4143108 , @vzakhari 
> wrote:
>
>> The new tests fail to link:
>
> That is, these new tests cause check-flang to fail.  @elmcdonough, can you 
> please fix things so that check-flang no longer fails?

Thank you for pointing this out, @vzakhari.

@PeteSteinfeld, I think vzakhari's most recent commit 

 fixes this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143301

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


[PATCH] D143704: [flang] Feature list plugin

2023-04-24 Thread Ethan Luis McDonough via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG00d0749f92ec: [flang] Feature list plugin (authored by 
elmcdonough).

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/CMakeLists.txt
  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%pluginext \
+! 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: Expr: 11
+! CHECK-NEXT: DataRef: 5
+! CHECK-NEXT: Designator: 5
+! CHECK-NEXT: ActualArg: 4
+! CHECK-NEXT: ActualArgSpec: 4
+! CHECK-NEXT: EntityDecl: 4
+! CHECK-NEXT: LiteralConstant: 4
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: Block: 3
+! CHECK-NEXT: DeclarationTypeSpec: 3
+! CHECK-NEXT: ExecutableConstruct: 3
+! CHECK-NEXT: ExecutionPart: 3
+! CHECK-NEXT: ExecutionPartConstruct: 3
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: IntLiteralConstant: 3
+! CHECK-NEXT: IntegerTypeSpec: 3
+! CHECK-NEXT: IntrinsicTypeSpec: 3
+! CHECK-NEXT: SpecificationPart: 3
+! CHECK-NEXT: AttrSpec: 2
+! CHECK-NEXT: Call: 2
+! CHECK-NEXT: DeclarationConstruct: 2
+! CHECK-NEXT: DummyArg: 2
+! CHECK-NEXT: IntentSpec: 2
+! CHECK-NEXT: IntentSpec::Intent: 2
+! CHECK-NEXT: InternalSubprogram: 2
+! CHECK-NEXT: ProcedureDesignator: 2
+! CHECK-NEXT: SpecificationConstruct: 2
+! CHECK-NEXT: TypeDeclarationStmt: 2
+! CHECK-NEXT: AssignmentStmt: 1
+! CHECK-NEXT: CallStmt: 1
+! CHECK-NEXT: CharLiteralConstant: 1
+! CHECK-NEXT: ContainsStmt: 1
+! CHECK-NEXT: EndFunctionStmt: 1
+! CHECK-NEXT: EndProgramStmt: 1
+! CHECK-NEXT: EndSubroutineStmt: 1
+! CHECK-NEXT: Expr::Add: 1
+! CHECK-NEXT: Expr::Multiply: 1
+! CHECK-NEXT: Format: 1
+! CHECK-NEXT: FunctionReference: 1
+! CHECK-NEXT: FunctionStmt: 1
+! CHECK-NEXT: FunctionSubprogram: 1
+! CHECK-NEXT: ImplicitPartStmt: 1
+! CHECK-NEXT: ImplicitStmt: 1
+! CHECK-NEXT: InternalSubprogramPart: 1
+! CHECK-NEXT: MainProgram: 1
+! CHECK-NEXT: OutputItem: 1
+! CHECK-NEXT: PrefixSpec: 1
+! CHECK-NEXT: PrintStmt: 1
+! CHECK-NEXT: Program: 1
+! CHECK-NEXT: ProgramStmt: 1
+! CHECK-NEXT: ProgramUnit: 1
+! CHECK-NEXT: SubroutineStmt: 1
+! CHECK-NEXT: SubroutineSubprogram: 1
+! CHECK-NEXT: Variable: 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%pluginext \
+! 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: DataRef: 11
+! CHECK-NEXT: Designator: 7
+! CHECK-NEXT: DeclarationTypeSpec: 6
+! CHECK-NEXT: Expr: 5
+! CHECK-NEXT: DeclarationConstruct: 4
+! CHECK-NEXT: EntityDecl: 4
+! CHECK-NEXT: IntrinsicTypeSpec: 4
+! CHECK-NEXT: SpecificationConstruct: 4
+! CHECK-NEXT: StructureComponent: 4
+! CHECK-NEXT: ActionStmt: 3
+! CHECK-NEXT: AssignmentStmt: 3
+! CHECK-NEXT: AttrSpec: 3
+! CHECK-NEXT: DummyArg: 3
+! CHECK-NEXT: ExecutableConstruct: 3
+! CHECK-NEXT: ExecutionPartConstruct: 3
+! CHECK-NEXT: ImplicitPart: 3
+! CHECK-NEXT: IntentSpec: 3
+! CHECK-NEXT: IntentSpec::Intent: 3
+! CHECK-NEXT: SpecificationPart: 3
+! CHECK-NEXT: TypeDeclarationStmt: 3
+! CHECK-NEXT: Variable: 3
+! CHECK-NEXT: Block: 2
+! CHECK-NEXT: ComponentDecl: 2
+! CHECK-NEXT: ComponentDefStmt: 2
+! CHEC