forked from OSchip/llvm-project
8d0c3c05f2
Summary: Most of these checks were already implemented, and I just added references to them to the code and tests. Also, much of this code was already reviewed in the old flang/f18 GitHub repository, but I didn't get to merge it before we switched repositories. I implemented the check for C747 to not allow coarray components in derived types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE. I implemented the check for C748 that requires a data component whose type has a coarray ultimate component to be a nonpointer, nonallocatable scalar and not be a coarray. I implemented the check for C750 that adds additional restrictions to the bounds expressions of a derived type component that's an array. These bounds expressions are sepcification expressions as defined in 10.1.11. There was already code in lib/Evaluate/check-expression.cpp to check semantics for specification expressions, but it did not check for the extra requirements of C750. C750 prohibits specification functions, the intrinsic functions ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It also requires every specification inquiry reference to be a constant expression, and requires that the value of the bound not depend on the value of a variable. To implement these additional checks, I added code to the intrinsic proc table to get the intrinsic class of a procedure. I also added an enumeration to distinguish between specification expressions for derived type component bounds versus for type parameters. I then changed the code to pass an enumeration value to "CheckSpecificationExpr()" to indicate that the expression was a bounds expression and used this value to determine whether to emit an error message when violations of C750 are found. I changed the implementation of IsPureProcedure() to handle statement functions and changed some references in the code that tested for the PURE attribute to call IsPureProcedure(). I also fixed some unrelated tests that got new errors when I implemented these new checks. Reviewers: tskeith, DavidTruby, sscalpone Subscribers: jfb, llvm-commits Tags: #llvm, #flang Differential Revision: https://reviews.llvm.org/D79263 |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
assignment.cpp | ||
assignment.h | ||
attr.cpp | ||
canonicalize-do.cpp | ||
canonicalize-do.h | ||
canonicalize-omp.cpp | ||
canonicalize-omp.h | ||
check-allocate.cpp | ||
check-allocate.h | ||
check-arithmeticif.cpp | ||
check-arithmeticif.h | ||
check-call.cpp | ||
check-call.h | ||
check-case.cpp | ||
check-case.h | ||
check-coarray.cpp | ||
check-coarray.h | ||
check-data.cpp | ||
check-data.h | ||
check-deallocate.cpp | ||
check-deallocate.h | ||
check-declarations.cpp | ||
check-declarations.h | ||
check-do-forall.cpp | ||
check-do-forall.h | ||
check-if-stmt.cpp | ||
check-if-stmt.h | ||
check-io.cpp | ||
check-io.h | ||
check-namelist.cpp | ||
check-namelist.h | ||
check-nullify.cpp | ||
check-nullify.h | ||
check-omp-structure.cpp | ||
check-omp-structure.h | ||
check-purity.cpp | ||
check-purity.h | ||
check-return.cpp | ||
check-return.h | ||
check-stop.cpp | ||
check-stop.h | ||
compute-offsets.cpp | ||
compute-offsets.h | ||
expression.cpp | ||
mod-file.cpp | ||
mod-file.h | ||
pointer-assignment.cpp | ||
pointer-assignment.h | ||
program-tree.cpp | ||
program-tree.h | ||
resolve-labels.cpp | ||
resolve-labels.h | ||
resolve-names-utils.cpp | ||
resolve-names-utils.h | ||
resolve-names.cpp | ||
resolve-names.h | ||
rewrite-parse-tree.cpp | ||
rewrite-parse-tree.h | ||
scope.cpp | ||
semantics.cpp | ||
symbol.cpp | ||
tools.cpp | ||
type.cpp | ||
unparse-with-symbols.cpp |