[PATCH] D98743: [flang] Order Symbols by source provenance

Peter Klausler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 16 14:37:23 PDT 2021


klausler created this revision.
klausler added a reviewer: PeteSteinfeld.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
klausler requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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().


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98743

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98743.331111.patch
Type: text/x-patch
Size: 24180 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210316/b82c1704/attachment-0001.bin>


More information about the llvm-commits mailing list