[all-commits] [llvm/llvm-project] 46ade6: [flang] Order Symbols by source provenance

Peter Klausler via All-commits all-commits at lists.llvm.org
Tue Mar 16 15:25:39 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 46ade6d0ef8fea94fbc28c75bb4bed4d928fd64b
      https://github.com/llvm/llvm-project/commit/46ade6d0ef8fea94fbc28c75bb4bed4d928fd64b
  Author: peter klausler <pklausler at nvidia.com>
  Date:   2021-03-16 (Tue, 16 Mar 2021)

  Changed paths:
    M flang/include/flang/Parser/char-block.h
    M flang/include/flang/Parser/provenance.h
    M flang/include/flang/Semantics/scope.h
    M flang/include/flang/Semantics/symbol.h
    M flang/lib/Evaluate/tools.cpp
    M flang/lib/Parser/parsing.cpp
    M flang/lib/Parser/provenance.cpp
    M flang/lib/Semantics/check-io.cpp
    M flang/lib/Semantics/resolve-names.cpp
    M flang/lib/Semantics/scope.cpp
    M flang/lib/Semantics/semantics.cpp
    M flang/test/Semantics/data05.f90
    M flang/test/Semantics/modfile21.f90
    M flang/test/Semantics/resolve102.f90
    M flang/test/Semantics/typeinfo01.f90
    M flang/unittests/Evaluate/intrinsics.cpp

  Log Message:
  -----------
  [flang] Order Symbols by source provenance

In parser::AllCookedSources, implement a map from CharBlocks to
the CookedSource instances that they cover.  This permits a fast
Find() operation based on std::map::equal_range to map a CharBlock
to its enclosing CookedSource instance.

Add a creation order number to each CookedSource.  This allows
AllCookedSources to provide a Precedes(x,y) predicate that is a
true source stream ordering between two CharBlocks -- x is less
than y if it is in an earlier CookedSource, or in the same
CookedSource at an earlier position.

Add a reference to the singleton SemanticsContext to each Scope.

All of this allows operator< to be implemented on Symbols by
means of a true source ordering.  From a Symbol, we get to
its Scope, then to the SemanticsContext, and then use its
AllCookedSources reference to call Precedes().

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




More information about the All-commits mailing list