[all-commits] [llvm/llvm-project] f7a15e: [flang] Use module file hashes for more checking a...

Peter Klausler via All-commits all-commits at lists.llvm.org
Fri Mar 1 13:58:48 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f7a15e0021697e2346d3aa335dedf2bb3cf468f9
      https://github.com/llvm/llvm-project/commit/f7a15e0021697e2346d3aa335dedf2bb3cf468f9
  Author: Peter Klausler <35819229+klausler at users.noreply.github.com>
  Date:   2024-03-01 (Fri, 01 Mar 2024)

  Changed paths:
    M flang/include/flang/Parser/provenance.h
    M flang/include/flang/Parser/source.h
    A flang/include/flang/Semantics/module-dependences.h
    M flang/include/flang/Semantics/semantics.h
    M flang/include/flang/Semantics/symbol.h
    M flang/lib/Parser/provenance.cpp
    M flang/lib/Parser/source.cpp
    M flang/lib/Semantics/mod-file.cpp
    M flang/lib/Semantics/mod-file.h
    M flang/lib/Semantics/resolve-names.cpp
    M flang/lib/Semantics/resolve-names.h
    M flang/lib/Semantics/semantics.cpp
    A flang/test/Semantics/Inputs/dir1/modfile63a.mod
    A flang/test/Semantics/Inputs/dir1/modfile63b.mod
    A flang/test/Semantics/Inputs/dir2/modfile63a.mod
    A flang/test/Semantics/Inputs/dir2/modfile63b.mod
    M flang/test/Semantics/getsymbols02.f90
    A flang/test/Semantics/modfile63.f90
    M flang/test/Semantics/test_modfile.py

  Log Message:
  -----------
  [flang] Use module file hashes for more checking and disambiguation (#80354)

f18's module files are Fortran with a leading header comment containing
the module file format version and a hash of the following contents.
This hash is currently used only to protect module files against
corruption and truncation.

Extend the use of these hashes to catch or avoid some error cases. When
one module file depends upon another, note its hash in additional module
file header comments. This allows the compiler to detect when the module
dependency is on a module file that has been updated. Further, it allows
the compiler to find the right module file dependency when the same
module file name appears in multiple directories on the module search
path.

The order in which module files are written, when multiple modules
appear in a source file, is such that every dependency is written before
the module(s) that depend upon it, so that their hashes are known.

A warning is emitted when a module file is not the first hit on the
module file search path.

Further work is needed to add a compiler option that emits (larger)
stand-alone module files that incorporate copies of their dependencies
rather than relying on search paths. This will be desirable for
application libraries that want to ship only "top-level" module files
without needing to include their dependencies.

Another future work item would be to admit multiple modules in the same
compilation with the same name if they have distinct hashes.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list