[flang-commits] [PATCH] D96465: [flang] Improve "Error reading module file" error message
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Thu Feb 11 11:08:34 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0bfa4ac6c6fc: [flang] Improve "Error reading module file" error message (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96465/new/
https://reviews.llvm.org/D96465
Files:
flang/lib/Semantics/mod-file.cpp
flang/test/Flang-Driver/include-module.f90
flang/test/Semantics/resolve12.f90
flang/test/Semantics/resolve26.f90
Index: flang/test/Semantics/resolve26.f90
===================================================================
--- flang/test/Semantics/resolve26.f90
+++ flang/test/Semantics/resolve26.f90
@@ -16,10 +16,10 @@
submodule(m1) s1
end
-!ERROR: Error reading module file for submodule 's1' of module 'm2'
+!ERROR: Cannot read module file for submodule 's1' of module 'm2': Source file 'm2-s1.mod' was not found
submodule(m2:s1) s2
end
-!ERROR: Error reading module file for module 'm3'
+!ERROR: Cannot read module file for module 'm3': Source file 'm3.mod' was not found
submodule(m3:s1) s3
end
Index: flang/test/Semantics/resolve12.f90
===================================================================
--- flang/test/Semantics/resolve12.f90
+++ flang/test/Semantics/resolve12.f90
@@ -6,7 +6,7 @@
end
use m1
-!ERROR: Error reading module file for module 'm2'
+!ERROR: Cannot read module file for module 'm2': Source file 'm2.mod' was not found
use m2
!ERROR: 'sub' is not a module
use sub
Index: flang/test/Flang-Driver/include-module.f90
===================================================================
--- flang/test/Flang-Driver/include-module.f90
+++ flang/test/Flang-Driver/include-module.f90
@@ -31,8 +31,8 @@
!-----------------------------------------
! EXPECTED OUTPUT FOR MISSING MODULE FILE
!-----------------------------------------
-! SINGLEINCLUDE:Error reading module file for module 'basictestmoduletwo'
-! SINGLEINCLUDE-NOT:Error reading module file for module 'basictestmoduletwo'
+! SINGLEINCLUDE:error: Cannot read module file for module 'basictestmoduletwo'
+! SINGLEINCLUDE-NOT:error: Cannot read module file for module 'basictestmoduletwo'
! SINGLEINCLUDE-NOT:error: Derived type 't1' not found
! SINGLEINCLUDE:error: Derived type 't2' not found
@@ -44,7 +44,7 @@
!---------------------------------------
! EXPECTED OUTPUT FOR ALL MODULES FOUND
!---------------------------------------
-! INCLUDED-NOT:Error reading module file
+! INCLUDED-NOT:error: Cannot read module file
! INCLUDED-NOT:error: Derived type 't1' not found
! INCLUDED:error: Derived type 't2' not found
Index: flang/lib/Semantics/mod-file.cpp
===================================================================
--- flang/lib/Semantics/mod-file.cpp
+++ flang/lib/Semantics/mod-file.cpp
@@ -861,13 +861,13 @@
parser::Message &ModFileReader::Say(const SourceName &name,
const std::string &ancestor, parser::MessageFixedText &&msg,
const std::string &arg) {
- return context_
- .Say(name,
- ancestor.empty()
- ? "Error reading module file for module '%s'"_err_en_US
- : "Error reading module file for submodule '%s' of module '%s'"_err_en_US,
- name, ancestor)
- .Attach(name, std::move(msg), arg);
+ return context_.Say(name, "Cannot read module file for %s: %s"_err_en_US,
+ parser::MessageFormattedText{ancestor.empty()
+ ? "module '%s'"_en_US
+ : "submodule '%s' of module '%s'"_en_US,
+ name, ancestor}
+ .MoveString(),
+ parser::MessageFormattedText{std::move(msg), arg}.MoveString());
}
// program was read from a .mod file for a submodule; return the name of the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96465.323083.patch
Type: text/x-patch
Size: 3211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20210211/04d71535/attachment.bin>
More information about the flang-commits
mailing list