[all-commits] [llvm/llvm-project] 1f525e: [flang][NFC] Add GetTopLevelUnitContaining functions

Tim Keith via All-commits all-commits at lists.llvm.org
Wed Dec 2 10:34:19 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1f525ece4abfb6077d73e34acac0666855d19052
      https://github.com/llvm/llvm-project/commit/1f525ece4abfb6077d73e34acac0666855d19052
  Author: Tim Keith <tkeith at nvidia.com>
  Date:   2020-12-02 (Wed, 02 Dec 2020)

  Changed paths:
    M flang/include/flang/Semantics/tools.h
    M flang/lib/Semantics/check-return.cpp
    M flang/lib/Semantics/resolve-names.cpp
    M flang/lib/Semantics/tools.cpp

  Log Message:
  -----------
  [flang][NFC] Add GetTopLevelUnitContaining functions

`GetTopLevelUnitContaining` returns the Scope nested in the global scope
that contains the given Scope or Symbol.

Use "Get" rather than "Find" in the name because "Find" implies it might
not be found, which can't happen. Following that logic, rename
`FindProgramUnitContaining` to `GetProgramUnitContaining` and have it
also return a reference rather that a pointer.

Note that the use of "ProgramUnit" is slightly confusing. In the Fortran
standard, "program-unit" refers to what is called a "TopLevelUnit" here.
What we are calling a "ProgramUnit" (here and in `ProgramTree`) includes
internal subprograms while "TopLevelUnit" does not.

Differential Revision: https://reviews.llvm.org/D92491




More information about the All-commits mailing list