clang give a compilation error on resolve-names.cc because there are
two overloadings of Pre(ProcedureDeclarationStmt) available in
ResolveNamesVisitor. One is defined in DeclTypeSpecVisitor and the other
in DeclarationVisitor. They are both brought in to ResolveNamesVisitor
via `using` statements.
The one in DeclarationVisitor is the one that is supposed to be called.
The other should have been removed when this one was added. This is the
one that gcc chooses to call, so this doesn't change any behavior.
The same applies to the Post method as well.
Original-commit: flang-compiler/f18@872f8faf96
Reviewed-on: https://github.com/flang-compiler/f18/pull/100
Add Dump() routines based on operator<< for the type so that they are
easy to call from the debugger. Overload for both pointer and reference
types and for dumping to std::cerr or a specific ostream.
Original-commit: flang-compiler/f18@ec6676eff0
Reviewed-on: https://github.com/flang-compiler/f18/pull/99
Replace operator=(Symbol) and operator=(DeclTypeSpec) with set_symbol()
and set_type() to make it clearer. Eliminate the move constructor as it
is not needed. Make all but the accessor functions out-of-line.
Change HasExplicitType() to NeedsExplicitType(), reversing its sense.
HasExplicitType() returned true for symbols that didn't have or need an
explicit type, which was confusing.
Original-commit: flang-compiler/f18@ada13ac6a3
Reviewed-on: https://github.com/flang-compiler/f18/pull/97
Add ObjectEntityDetails and ProcEntityDetails to distinguish between an
entity from an object-decl and one from a proc-decl. When we don't know,
it stays as EntityDetails until it is resolved. DeclareEntity() in
DeclarationVisitor creates this kind of symbol.
Add flags to Symbol as a convenient place for boolean flags common to
many kinds of symbols. Use it to mark symbols known to be functions or
subroutines so that we can report errors when they are used incorrectly.
Improve handling of EXTERNAL statement.
Handle ProcDecl nodes and add symbols for them.
Partial processing of derived types. Data component declarations are
processed and added to the derived type. Define TypeBoundProc and
TypeBoundGeneric in type.h. Procedure components, type-bound procedures,
etc. are not handled yet and nothing is done with the derived type once
it is created. Eliminate DerivedTypeDefBuilder in favor of just setting
fields in derivedTypeData_.
Add GetDeclTypeSpec to go with BeginDeclTypeSpec and EndDeclTypeSpec, to
avoid directly access the private variable.
Add tests in resolve20.f90 for errors related to procedure declarations.
Add missing copyrights to other tests.
Original-commit: flang-compiler/f18@40e65c1465
Reviewed-on: https://github.com/flang-compiler/f18/pull/97
Tree-same-pre-rewrite: false
This handles the common case of an error message referring to
a name, and an attached message referring to another name.
For example, reporting an error where a name is already declared
and mentioning the previous declaration.
Original-commit: flang-compiler/f18@901b50dcf2
Reviewed-on: https://github.com/flang-compiler/f18/pull/97
Tree-same-pre-rewrite: false
When a generic or specific procedure is use-associated, make a copy of
it in the current scope (replacing the symbol that has UseDetails) so
that we can make changes to it. This permits a generic to be defined in
one module and extended with more specific procedures in another.
When a specific procedure has the same name as its generic, it can't be
stored directly in the scope because that is indexed by name and the
generic is already there. So instead we store the specific in the
GenericDetails of the generic symbol.
Enforce the rule that a generic and a procedure can only have the same
name if the procedure is one of the specifics of the generic.
Refactorings done is support of this change:
- Add FindSymbol() and EraseSymbol() as helpers to find or erase a
symbol in the current scope. Make use of FindSymbol() where appropriate.
- Add SayAlreadyDeclared() to report a common error.
Original-commit: flang-compiler/f18@be479b9887
Reviewed-on: https://github.com/flang-compiler/f18/pull/95
This is the result of running `f18 -fdebug-resolve-names` on a bunch of
Fortran source and fixing the resulting assertion errors and segmentation
faults.
Most of the problems were with encountering attributes, array specs, or
declaration type specs when we weren't prepared to handle them. Those
were fixed by adding calls to {Begin,End}DeclTypeSpec and {Begin,End}Decl
when encountering certain nodes, though the real work for those nodes is
still to be done.
Extract some common functionality into PostAttrSpec and CheckUseError.
Add missing XOR to GenericSpec.
Original-commit: flang-compiler/f18@3c0ff7ded4
Reviewed-on: https://github.com/flang-compiler/f18/pull/93
Tree-same-pre-rewrite: false
Add subprogram symbols for each interface-body and set isInterface on
them. Create a symbol with GenericDetails for each generic interface
block and add interface specifications to the specific procedures of
the generic. InterfaceVisitor takes care of this.
Before processing the specification part of modules and subprograms,
collect the names of module subprograms and internal subprograms and add
them to the symbol table with SubprogramNameDetails. This allows us to
reference them from interface blocks in the specification part.
SubprogramNameDetails is converted to SubprogramDetails when the real
subprogram is visited.
This is achieved by setting subpNamesOnly_ and then walking the
ModuleSubprogramPart or InternalSubprogramPart. Creating the symbol and
scope for a module or subprogram now happens when the Module,
SubroutineSubprogram, or FunctionSubprogram node is encountered so
this can happen in the right order.
Add BeginSubprogram and EndSubprogram to handle the parts in common
between subprograms and interface specifications.
Add GenericSpec to type.h to represent all possible generic specs.
Only generic names are resolved so far.
Add tests for new error messages. Change resolve02.f90 to reflect the
new errors reported.
Original-commit: flang-compiler/f18@03148b49dd
Reviewed-on: https://github.com/flang-compiler/f18/pull/88
Tree-same-pre-rewrite: false
This is just refactoring. SubprogramVisitor now contains the functionality
related to subprograms, including statement functions. This is preparation
for handling interface blocks.
Also, change MessageHandler to create the Messages object and return it
through an accessor rather than having it created outside and passed in.
This saves us from having to pass it up through the chain of constructors.
Original-commit: flang-compiler/f18@f73cfa2fe9
Reviewed-on: https://github.com/flang-compiler/f18/pull/88
Tree-same-pre-rewrite: false
When a USE statement is encountered, find the scope corresponding to the
module. This is now stored in the ModuleDetails of the module symbol.
useModuleScope_ tracks this while processing the USE. Currently only
modules defined in the same file work because we don't have module files.
At the end of a USE that isn't a use-only, add all public names that
were not renamed.
AddUse() handles recording of a USE by creating a local symbol with
UseDetails that tracks the use-symbol in the module and the location of
the USE (for error messages). If an ambiguous USE is detected, the
UseDetails are replaced by UseErrorDetails. This tracks the locations of
all the uses so that they can be referenced in a diagnostic.
Detect attempts to re-declare use-associated symbols as well as changing
their attributes (except for ASYNCHRONOUS and VOLATILE).
Add missing checks for access-stmt in scoping units other than modules.
Add tests for the new errors.
Reorganize the MessageHandler::Say() overloadings to prevent them from
becoming too numerous.
Original-commit: flang-compiler/f18@cc0523134c
Reviewed-on: https://github.com/flang-compiler/f18/pull/79
Add ScopeHandle class to manage the stack of scopes and MakeSymbol(), which
makes a symbol in the current scope. Move the call to ApplyImplicitScopes()
into PopScope() as it must be done for each scope.
Add ModuleVisitor class to manage module-related resolution. Currently that
consists of beginning and ending modules and access statements. This is
preparation for further module work.
Replace references to parser::CharBlock with SourceName.
Original-commit: flang-compiler/f18@913df85e48
Reviewed-on: https://github.com/flang-compiler/f18/pull/79
Tree-same-pre-rewrite: false
The include guard symbol is `FORTRAN_$dir_$file_H_` where $dir is the
subdirectory of `lib` and $file is the basename of the header file.
Those names are mapped to uppercase and hyphens are replaced by
underscores.
Original-commit: flang-compiler/f18@ac9c0e7106
Reviewed-on: https://github.com/flang-compiler/f18/pull/75
When an access statement repeats the same attribute, make it a non-fatal
diagnostic. Also, include the previous specification in the message.
resolve11.f90 now illustrates both cases, fatal and non-fatal.
Original-commit: flang-compiler/f18@1f567c740a
Reviewed-on: https://github.com/flang-compiler/f18/pull/70
Tree-same-pre-rewrite: false
Recognize modules and open and close the corresponding scope.
Handle PUBLIC and PRIVATE statements and set the corresponding
attributes on entity declarations in the module.
Refactoring (no functional changes): Make CheckImplicitSymbol() and
GetVariableName() overloadings private and out-of-line.
Add missing option to f18 help.
Original-commit: flang-compiler/f18@d01cacca63
Reviewed-on: https://github.com/flang-compiler/f18/pull/70
Tree-same-pre-rewrite: false
parse-tree.h, parse-tree.cc:
Add FunctionReference::ConvertToArrayElementRef() to convert a function
reference to an array element reference.
Factor out MakeArrayElementRef() to use in ConvertToArrayElementRef()
and also in converting statement functions to array element assignments.
resolve-names.cc:
Recognize references to functions and subroutines and add symbols for them.
Detect declaration conflicts from these and check `IMPLICIT NONE(EXTERNAL)`.
rewrite-parse-tree.cc:
Find function references that need to be converted and rewrite them.
Original-commit: flang-compiler/f18@e5a1e0aaef
Reviewed-on: https://github.com/flang-compiler/f18/pull/65
Add parse-tree-mutator.h like parse-tree-visitor.h except that the Walk
functions take non-const references to parse tree nodes so the Pre and
Post methods of the mutator that are passed around can make changes to
the parse tree.
Change ExecutionPart to be a class that wraps a list so that it can be
identified during parse tree walking.
Add Symbol* field to parser::Name for the result of symbol resolution.
In parse tree dumper, dump symbol when it is there instead of just name.
Add RewriteParseTree to walk the parse tree, fill in resolved symbols in
Name nodes, and make necessary changes to the structure. Currently that
consists of rewriting statement functions as array assignments when
appropriate.
In ResolveNames, call RewriteParseTree if the resolution was successful.
Recognize a statement function that comes after a mis-identified
statement function and report an error. resolve08.f90 tests this case.
Add -fdebug-dump-symbols to dump the scope tree and symbols in each scope.
This is implemented by DumpSymbols in resolve-names.cc. Add an optional
symbol to scopes that correspond to symbols (e.g. subprograms). Remove
debug output from ResolveNamesVisitor as this option can be used instead.
Original-commit: flang-compiler/f18@9cd3372265
Reviewed-on: https://github.com/flang-compiler/f18/pull/60
Tree-same-pre-rewrite: false
SubprogramDetails: Store dummy args and result as symbols, not names.
Symbol: Save list of occurrences (i.e. SourceNames that map to the same
symbol). This is needed to map Names in the parse tree back to symbols,
and will probably be useful when reporting errors.
Improve dumping of symbols.
resolve-names.cc: Recognize statement functions. They are treated like
function subprograms but the result type and type of dummy arguments come
from the enclosing scope. The implicit rules from the enclosing scope need
to be copied in.
Original-commit: flang-compiler/f18@44e4fb4b6c
Reviewed-on: https://github.com/flang-compiler/f18/pull/58
Tree-same-pre-rewrite: false
Add ArraySpecVisitor to recognize the various forms of array specifications.
They are tracked in arraySpec_ and attrArraySpec_. Both are needed because
a declaration like `integer, dimension(4) :: x(2,2), y` has two different
array-specs.
The method DeclareEntity was extracted out to handle the common part for
EntityDecl, ObjectDecl, and DimensionStmt. AllocatableStmt and TargetStmt
are now handled through their contained ObjectDecl.
The test resolve07 checks the interactions between these kinds of declarations.
Rename ComponentArraySpec to ArraySpec as it doesn't just occur in components.
Fix some 'begin' and 'end' methods to start with upper-case letters.
Original-commit: flang-compiler/f18@113bfc4fe7
Reviewed-on: https://github.com/flang-compiler/f18/pull/56
"f18 -fdebug-resolve-names -fparse-only ..." is equivalent to what
test-type used to do, so the test-type executable can be eliminated.
-fdebug-dump-parse-tree does the parse-tree dumping that test-sema
does, but test-sema does more so I have left it alone.
Original-commit: flang-compiler/f18@8b3816528e
Reviewed-on: https://github.com/flang-compiler/f18/pull/55
Add ArraySpecVisitor to recognize the various forms of array specifications.
They are tracked in arraySpec_ and attrArraySpec_. Both are needed because
a declaration like `integer, dimension(4) :: x(2,2), y` has two different
array-specs.
The method DeclareEntity was extracted out to handle the common part for
EntityDecl, ObjectDecl, and DimensionStmt. AllocatableStmt and TargetStmt
are now handled through their contained ObjectDecl.
The test resolve07 checks the interactions between these kinds of declarations.
Rename ComponentArraySpec to ArraySpec as it doesn't just occur in components.
Fix some 'begin' and 'end' methods to start with upper-case letters.
Original-commit: flang-compiler/f18@3d4d7430b5
Reviewed-on: https://github.com/flang-compiler/f18/pull/53
Includes like "../dir/file.h" should sort after local includes.
This change fixes that and applies the new formatting.
Now the order (in reverse) is:
- system includes
- includes from llvm or clang (this is from the default IncludeCategories)
- includes of ../something
- everything else
Original-commit: flang-compiler/f18@324643d63a
Reviewed-on: https://github.com/flang-compiler/f18/pull/52
In Symbol and Scope, use SourceName (== parser::CharBlock) in place of
Name (== std::string) so that names in the symtab have provenance. We
may ultimately have multiple source locations associated with a symbol.
ImplicitRules: Add isImplicitNoneType and isImplicitNoneExternal flags.
MessageHandler: Add methods to emit messages associated with source
locations.
Detect conflicting declarations of symbols (e.g. as subprogram and
variable).
Handle attribute statements like ASYNCHRONOUS statement: make sure the
symbol is present and set the attribute on it. Check that these all have
a type declared by the end of the specification part if IMPLICIT NONE.
Find variables named in Variable and Expr nodes and check they have
types declared if IMPLICIT NONE. Otherwise, make sure they are in the
symtab and apply the implicit type rules at the end of the scope.
Push a scope for MainProgram nodes and add a symbol for the name if it
has one.
Rename Scope::map_type to Scope::mapType
Add tests for errors currently being detected. There is no framework for
running them yet, just source files with the expected errors in
comments.
Original-commit: flang-compiler/f18@39e6fa4169
Reviewed-on: https://github.com/flang-compiler/f18/pull/49
Tree-same-pre-rewrite: false
Maintain stack of ImplicitRules in parallel with the scope stack.
I doesn't have to live as long as the scopes.
Allow for '_', '$', and '@' in ImplicitRules if they come through from
the parser.
Original-commit: flang-compiler/f18@b70e9fc956
Reviewed-on: https://github.com/flang-compiler/f18/pull/41
ImplicitRules maintains a mapping of initial character of an identifier
to its implicit type.
ImplicitRulesVisitor visits the ImplicitStmt and related parse tree
nodes and updates the rules.
Emit errors messages in these cases:
- implicit type specified more than once for a letter
- IMPLICIT statement and IMPLICIT NONE in same scope
- IMPLICIT statement and IMPLICIT NONE(TYPE) in same scope
- more than one IMPLICIT NONE in a scope
- IMPLICIT statement with empty range of letters
- IMPLICIT NONE statement after PARAMETER statement
- TYPE or EXTERNAL repeated in an IMPLICIT NONE statement
Also start emitting error messages through the parser::Messages
interface. An instance of Messages is created from the cooked source and
saved in the MessageHandler class. It tracks the source location of the
current statement and provides a way to emit messages associated with
that statement.
Original-commit: flang-compiler/f18@e12fea9850
Reviewed-on: https://github.com/flang-compiler/f18/pull/41
Tree-same-pre-rewrite: false
Enhance DeclTypeSpecVisitor to find derived-type-specs, including with
type parameter values.
Change DerivedTypeSpec so it only needs the name of the derived type,
not the definition, as that isn't necessarily known when we encounter
it.
Fix how memory is managed in DeclTypeSpec: Intrinsic type specs aren't a
problem -- they are one of a few types that live throughout the program.
Derived type specs are dynamically allocated and the memory is owned by
the DeclTypeSpec -- it allocates it when a DeclTypeSpec for a derived
type is created and deletes it when it is destroyed. Pass around
references to TypeSpecs rather than pointers as they can never be null.
In AttrsVisitor, DeclTypeSpecVisitor, ResolveNamesVisitor: make most
functions out-of-line to clean up the class declaration.
In AttrsVisitor, use preprocessor to simplify the simple case of
encountering a parse-tree class causing an attribute to be set.
Handle all such attributes.
Remove old testing code from type.cc.
Remove some of the declarations for IntExpr and IntConst -- they are
only placeholder classes anyway. Don't distinguish kind and length
parameter values.
Original-commit: flang-compiler/f18@e172b51212
Reviewed-on: https://github.com/flang-compiler/f18/pull/36
Tree-same-pre-rewrite: false
Work on scanning compiler directive lines.
Fix glitch in earlier change to parse-state.h.
Add ClassifyLine(), simplify some token sequence data lifetimes and interfaces.
Handle continued directives. Obey !DIR$ FIXED and FREE in prescanner.
Some refactoring of TokenSequence API, then support initial directives (FIXED, FREE, IGNORE_TKR).
Fix !DIR$ IGNORE_TKR syntax, manual was wrong.
Debugging directive scanning & parsing.
Profiling-directed speed-up - do not map cooked source locations to Provenance until a Message is emitted. Turn some non-nullable pointers into references.
Debugging.
Handle !DIR$ IVDEP too, it is in a test.
Accept directives in the execution part.
Original-commit: flang-compiler/f18@fb2ff367ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/34
Tree-same-pre-rewrite: false
This replaces DEFINE_NESTED_ENUM_CLASS in parse-tree.h but works
similarly. "ENUM_CLASS(Foo, A, B, C)" defined enum class Foo with
enumerators A, B, C. It also defines an overloading of EnumToString
that converts enumerators to their string representation.
Change unparse.cc to adapt to this change.
Make use of ENUM_CLASS in attr.h and attr.cc.
Original-commit: flang-compiler/f18@c45b8f172a
Reviewed-on: https://github.com/flang-compiler/f18/pull/31
Create interval.h. Use std::size_t instead of bare size_t. Redefine parser::Name to not be just a bare string.
Break out and rename CharBlock from token-sequence.h for use in the parse tree.
Incremental replacement of name strings with pointers to cooked characters.
Fix case sensitivity problem.
Use new CharBlock encoding to replace strings for real literal constants.
Normalized cooked character stream to lower case.
Simplify parsing now that cooked stream is lower case. Replace Keyword in parse tree.
Add static_asserts to || and recovery parsers to enforce same result types.
Remove needless TODO comment inserted earlier.
Fix case conversion on prefixed character literals (f90_correct/dc04.f90).
Use CharBlock in user-state.h.
Complete transition from nextChar to nextCh (i.e., always use pointers).
Document extensions. Begin work on compiler directive lines.
More documentation work.
Reformat prescan.cc.
More work on compiler directive scanning.
Original-commit: flang-compiler/f18@38d0404e16
Reviewed-on: https://github.com/flang-compiler/f18/pull/29
Tree-same-pre-rewrite: false
Use "namespace Fortran::semantics".
Add helper MakeSymbol() functions to ResolveNameVisitor to make a symbol
in the current scope.
Start work on subroutines, similar to what's been done for functions.
Original-commit: flang-compiler/f18@afe84af1c7
Reviewed-on: https://github.com/flang-compiler/f18/pull/30
A Symbol consists of a common part (in class Symbol) containing name,
owner, attributes. Information for a specific kind of symbol is in a
variant containing one of the *Details classes. So the kind of symbol is
determined by the type of details class stored in the details_ variant.
For scopes there is a single Scope class with an enum indicating the
kind. So far there isn't a need for extra kind-specific details as with
Symbols but that could change. Symbols defined in a Scope are stored
there in a simple map.
resolve-names.cc is a partial implementation of a parse-tree walker that
resolves names to Symbols. Currently is only handles functions (which
introduce a new Scope) and entity-decls. The test-type executable was
reused as a driver for this to avoid the need for a new one.
Sample output is below. When each "end function" is encountered the
scope is dumped, which shows the symbols defined in it.
$ cat a.f90
pure integer(8) function foo(arg1, arg2) result(res)
integer :: arg1
real :: arg2
contains
function bar(arg1)
real :: bar
real :: arg1
end function
end function
$ Debug/tools/f18/test-type a.f90
Subprogram scope: 0 children
arg1: Entity type: REAL
bar: Entity type: REAL
Subprogram scope: 1 children
arg1: Entity type: INTEGER
arg2: Entity type: REAL
bar: Subprogram (arg1)
foo: Subprogram (arg1, arg2) result(res)
res: Entity type: INTEGER(8)
Original-commit: flang-compiler/f18@1cd2fbc04d
Reviewed-on: https://github.com/flang-compiler/f18/pull/30
Tree-same-pre-rewrite: false
Clean out old data structure formatter.
Create stand-alone Parsing class to compose parts of the parser together.
Hello, world!
Better error recovery on command line errors.
Fix bugs from initial run at f77_correct.
Allow parentheses on PROGRAM statement.
Fix Hollerith scanning.
Remove REDIMENSION with good error recovery.
Fix new "spaces" parser, clean up calls to it.
Fix bugs exposed by in38.f90.
Escaped \a is not special to pgf90; get slashes around STRUCTURE name right.
Better multi-byte source encoding support in Hollerith.
Reformat C++.
More work on multi-byte source encoding.
Pass 219 tests in f77_correct, with good excuses for the rest.
Original-commit: flang-compiler/f18@8a1a0aa2dc
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
This simplifies the "delete and set to null" pattern to just a call to
reset(), and "assign and set to null" to a call to std::move.
The ideal would be a custom deleter that throws an error when an
implicit delete happens but not when reset() is called, but I'm not sure
that's possible.
Original-commit: flang-compiler/f18@f618fc729a
Reviewed-on: https://github.com/flang-compiler/f18/pull/23
This replaces the manual walking code in test-type.cc. It walks the
parse tree and constructs DeclTypeSpec and DerivedTypeDef objects for
each type encountered. It's in a new file, make-types.cc, so that
failing compilations complete faster.
Handle more parts of derived type definitions.
Also some minor cleanups in type.h and type.cc.
Original-commit: flang-compiler/f18@859e7e2665
Reviewed-on: https://github.com/flang-compiler/f18/pull/23
Tree-same-pre-rewrite: false
The classes that were segregated into format-specification.h have
also been grouped into a new Fortran::format namespace.
Code added to tools/f18/f18.cc to run a minimal visitor over
the parse trees resulting from successful parses so that any
future build problems with Walk() will be caught earlier.
Rearrange Walk instances, keep format:: ones together.
Original-commit: flang-compiler/f18@685ddb91ce
Reviewed-on: https://github.com/flang-compiler/f18/pull/22
Add a CLASS_TRAIT macro to idioms.h to define template metaprogramming
based on definable traits of user-defined classes. Tweak the boilerplate
macros in parse-tree.h to add traits to the empty, wrapper, union, and
tuple classes in the parse tree. Replace the macros in parse-tree-visitor.h
with trait-driven templates.
Original-commit: flang-compiler/f18@02400146fb
Reviewed-on: https://github.com/flang-compiler/f18/pull/20
Tree-same-pre-rewrite: false
Add characters.h to consolidate all per-character functions
and reduce dependence on <cctype>.
Add omitted DIRECT= and UNFORMATTED= specifiers to INQUIRE statement.
Add Interval<>, rebase ProvenanceRange upon it, rebase CharPointerWithLength
and rename it ContiguousChars.
Reformat C++.
Original-commit: flang-compiler/f18@78c73c62ba
Reviewed-on: https://github.com/flang-compiler/f18/pull/19
Tree-same-pre-rewrite: false
an unparsing feature.
Enum classes in parse tree node class types are now defined with
a macro so that the names of the enumerations can be captured for
formatting purposes.
Add a TODO comment.
Rebase to new master with parse tree traversal code.
Original-commit: flang-compiler/f18@d6bfcfd526
Reviewed-on: https://github.com/flang-compiler/f18/pull/16
Fortran::FormatItem and UseStmt have both normal fields and a variant
named 'u'. The Walk calls for the normal fields were missing.
These were the only two classes I found where this occurs.
Original-commit: flang-compiler/f18@23b8695a74
Reviewed-on: https://github.com/flang-compiler/f18/pull/17
Unparse takes a parse tree and converts it back to Fortran.
class UnparseVisitor implements a parse tree visitor that emits
the appropriate Fortran source for each node that it visits.
It is only partially implemented so far.
Change f18 to dump the parse tree using Unparse.
Original-commit: flang-compiler/f18@e80c13ec88
Reviewed-on: https://github.com/flang-compiler/f18/pull/15
Group the Walk functions that call WalkTupleClass, WalkUnionClass,
WalkWrapperClass all together, after the ones that don't follow a
simple pattern like that.
Fix the name of the include guard macro.
Original-commit: flang-compiler/f18@711613a4ad
Reviewed-on: https://github.com/flang-compiler/f18/pull/15
Tree-same-pre-rewrite: false
The classes in parse-tree.h that used WRAPPER_CLASS_BOILERPLATE were
accidentally omitted.
Also remove the anonymous namespace around utilities like
WalkWrapperClass as they can be useful outside this file too.
Original-commit: flang-compiler/f18@d47c505441
Reviewed-on: https://github.com/flang-compiler/f18/pull/15
Tree-same-pre-rewrite: false
The thing called on each parse tree node during the walk is still
referred to as a visitor.
Change "pre" to "Pre" and "post" to "Post" to follow the naming
conventions.
Original-commit: flang-compiler/f18@a6ea1296b1
Reviewed-on: https://github.com/flang-compiler/f18/pull/15
Tree-same-pre-rewrite: false
Add VisitWrapperClass, VisitTupleClass, and VisitVariantClass to
simplify the common cases in the parse tree. ForEachInTuple is used to
implement VisitTupleClass.
Original-commit: flang-compiler/f18@c6ae2b833b
Reviewed-on: https://github.com/flang-compiler/f18/pull/15
Tree-same-pre-rewrite: false
comments, continuations, &c. that have become obsolete with the use
of the new C++-coded prescanner module. Clean out members from
ParseState that were used only by cookedNextChar and its sub-parsers.
Original-commit: flang-compiler/f18@41717531e5
Reviewed-on: https://github.com/flang-compiler/f18/pull/11
Tree-same-pre-rewrite: false
Now the only targets in Makefile are Debug, Release, and reformat.
"make reformat" reformats all C++ source in place.
Also includes the result of "make reformat". Most of the changes were
just moving the "main" include up.
Original-commit: flang-compiler/f18@cf7d3a7afb