llvm-project/flang/test/Semantics/test_symbols.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
1.0 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# Compile a source file with '-funparse-with-symbols' and verify
# we get the right symbols in the output, i.e. the output should be
# the same as the input, except for the copyright comment.
# Change the compiler by setting the F18 environment variable.
F18_OPTIONS="-funparse-with-symbols"
srcdir=$(dirname $0)
source $srcdir/common.sh
[[ ! -f $src ]] && echo "File not found: $src" && exit 1
src1=$temp/1.f90
src2=$temp/2.f90
src3=$temp/3.f90
diffs=$temp/diffs
# Strip out blank lines and all comments except "!DEF:", "!REF:", and "!$omp"
sed -e 's/!\([DR]EF:\)/KEEP \1/' -e 's/!\($omp\)/KEEP \1/' \
-e 's/!.*//' -e 's/ *$//' -e '/^$/d' -e 's/KEEP \([DR]EF:\)/!\1/' \
-e 's/KEEP \($omp\)/!\1/' \
$src > $src1
egrep -v '![DR]EF:' $src1 > $src2 # strip out DEF and REF comments
# compile, inserting comments for symbols:
( cd $temp; $F18 $F18_OPTIONS $(basename $src2) ) > $src3
[flang] Resolve names in ASSOCIATE and SELECT TYPE Create `AssocEntityDetails` for symbols that represent entities identified by the associate-name in ASSOCIATE and SELECT TYPE constructs. For ASSOCIATE, create a new scope for the associated entity. For SELECT TYPE, create a new scope for each of type guard blocks. Each one contains an associated entity with the appropriate type. For SELECT TYPE, also create a place-holder symbol for the associate-name in the SELECT TYPE statement. The real symbols are in the new scopes and none of them is uniquely identified with the associate-name. Handling of `Selector` is common between these, with `associate-name => expr | variable` recorded in `ConstructVisitor::association_`. When the selector is an expression, derive the type of the associated entity from the type of the expression. This required some refactoring of how `DeclTypeSpec`s are created. The `DerivedTypeSpec` that comes from and expression is const so we can only create const `DeclTypeSpec`s from it. But there were times during name resolution when we needed to set type parameters in the current `DeclTypeSpec`. Now the non-const `DerivedTypeSpec` is saved separately from the const `DeclTypeSpec` while we are processing a declaration type spec. This makes it unnecessary to save the derived type name. Add a type alias for `common::Indirection` to reduce verbosity. Original-commit: flang-compiler/f18@b7668cebe49a122ea23c89c81eafdeba243bbfaf Reviewed-on: https://github.com/flang-compiler/f18/pull/261 Tree-same-pre-rewrite: false
2019-01-16 08:59:20 +08:00
if diff -w -U999999 $src1 $src3 > $diffs; then
echo PASS
else
sed '1,/^\@\@/d' $diffs
echo
echo FAIL
exit 1
fi