[flang-commits] [PATCH] D87035: [flang] Make -fget-symbols-sources output deterministic

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Sep 2 09:33:03 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGf80866bd4a2a: [flang] Make -fget-symbols-sources output deterministic (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87035/new/

https://reviews.llvm.org/D87035

Files:
  flang/lib/Semantics/semantics.cpp
  flang/test/Semantics/getsymbols01.f90
  flang/test/Semantics/getsymbols02.f90
  flang/test/Semantics/getsymbols03-a.f90
  flang/test/Semantics/getsymbols04.f90
  flang/test/Semantics/getsymbols05.f90


Index: flang/test/Semantics/getsymbols05.f90
===================================================================
--- flang/test/Semantics/getsymbols05.f90
+++ flang/test/Semantics/getsymbols05.f90
@@ -11,5 +11,5 @@
 
 ! RUN: %f18 -fget-symbols-sources -fparse-only %s 2>&1 | FileCheck %s
 ! CHECK:x:{{.*}}getsymbols05.f90, 3, 14-15
-! CHECK:y:{{.*}}getsymbols05.f90, 4, 14-15
 ! CHECK:x:{{.*}}getsymbols05.f90, 6, 16-17
+! CHECK:y:{{.*}}getsymbols05.f90, 4, 14-15
Index: flang/test/Semantics/getsymbols04.f90
===================================================================
--- flang/test/Semantics/getsymbols04.f90
+++ flang/test/Semantics/getsymbols04.f90
@@ -8,5 +8,5 @@
 
 ! RUN: %f18 -fget-symbols-sources -fparse-only %s 2>&1 | FileCheck %s
 ! CHECK:x:{{.*}}getsymbols04.f90, 3, 14-15
-! CHECK:y:{{.*}}getsymbols04.f90, 4, 14-15
 ! CHECK:x:{{.*}}getsymbols04.f90, 5, 11-12
+! CHECK:y:{{.*}}getsymbols04.f90, 4, 14-15
Index: flang/test/Semantics/getsymbols03-a.f90
===================================================================
--- flang/test/Semantics/getsymbols03-a.f90
+++ flang/test/Semantics/getsymbols03-a.f90
@@ -8,7 +8,7 @@
 end program
 
 ! RUN: %f18 -fget-symbols-sources -fparse-only %s 2>&1 | FileCheck %s
-! CHECK:mm3:{{.*}}getsymbols03-b.f90, 1, 8-11
 ! CHECK:f:{{.*}}getsymbols03-b.f90, 2, 12-13
 ! CHECK:main:{{.*}}getsymbols03-a.f90, 4, 9-13
+! CHECK:mm3:{{.*}}getsymbols03-b.f90, 1, 8-11
 ! CHECK:x:{{.*}}getsymbols03-a.f90, 6, 13-14
Index: flang/test/Semantics/getsymbols02.f90
===================================================================
--- flang/test/Semantics/getsymbols02.f90
+++ flang/test/Semantics/getsymbols02.f90
@@ -10,5 +10,5 @@
 ! RUN: %f18 -fparse-only %S/Inputs/getsymbols02-a.f90
 ! RUN: %f18 -fparse-only %S/Inputs/getsymbols02-b.f90
 ! RUN: %f18 -fget-symbols-sources -fparse-only %s 2>&1 | FileCheck %s
-! CHECK: get5: mm2a
 ! CHECK: callget5: mm2b
+! CHECK: get5: mm2a
Index: flang/test/Semantics/getsymbols01.f90
===================================================================
--- flang/test/Semantics/getsymbols01.f90
+++ flang/test/Semantics/getsymbols01.f90
@@ -16,10 +16,10 @@
 end module
 
 ! RUN: %f18 -fget-symbols-sources -fparse-only %s 2>&1 | FileCheck %s
+! CHECK-COUNT-1:f:{{.*}}getsymbols01.f90, 12, 26-27
 ! CHECK-COUNT-1:mm1:{{.*}}getsymbols01.f90, 2, 8-11
 ! CHECK-COUNT-1:s:{{.*}}getsymbols01.f90, 5, 18-19
-! CHECK-COUNT-1:x:{{.*}}getsymbols01.f90, 5, 21-22
-! CHECK-COUNT-1:y:{{.*}}getsymbols01.f90, 5, 24-25
 ! CHECK-COUNT-1:ss:{{.*}}getsymbols01.f90, 9, 19-21
-! CHECK-COUNT-1:f:{{.*}}getsymbols01.f90, 12, 26-27
+! CHECK-COUNT-1:x:{{.*}}getsymbols01.f90, 5, 21-22
 ! CHECK-COUNT-1:x:{{.*}}getsymbols01.f90, 13, 24-25
+! CHECK-COUNT-1:y:{{.*}}getsymbols01.f90, 5, 24-25
Index: flang/lib/Semantics/semantics.cpp
===================================================================
--- flang/lib/Semantics/semantics.cpp
+++ flang/lib/Semantics/semantics.cpp
@@ -45,17 +45,17 @@
 
 namespace Fortran::semantics {
 
-using NameToSymbolMap = std::map<const char *, SymbolRef>;
+using NameToSymbolMap = std::multimap<parser::CharBlock, SymbolRef>;
 static void DoDumpSymbols(llvm::raw_ostream &, const Scope &, int indent = 0);
 static void PutIndent(llvm::raw_ostream &, int indent);
 
 static void GetSymbolNames(const Scope &scope, NameToSymbolMap &symbols) {
   // Finds all symbol names in the scope without collecting duplicates.
   for (const auto &pair : scope) {
-    symbols.emplace(pair.second->name().begin(), *pair.second);
+    symbols.emplace(pair.second->name(), *pair.second);
   }
   for (const auto &pair : scope.commonBlocks()) {
-    symbols.emplace(pair.second->name().begin(), *pair.second);
+    symbols.emplace(pair.second->name(), *pair.second);
   }
   for (const auto &child : scope.children()) {
     GetSymbolNames(child, symbols);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87035.289495.patch
Type: text/x-patch
Size: 3840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20200902/323ceff3/attachment-0001.bin>


More information about the flang-commits mailing list