[flang-commits] [flang] 9362698 - [flang] Change DIE("unreachable") cases to use llvm_unreachable
David Truby via flang-commits
flang-commits at lists.llvm.org
Mon Jun 15 09:21:44 PDT 2020
Author: David Truby
Date: 2020-06-15T17:21:35+01:00
New Revision: 9362698450d1843e7fde98d8012a7308244c2d79
URL: https://github.com/llvm/llvm-project/commit/9362698450d1843e7fde98d8012a7308244c2d79
DIFF: https://github.com/llvm/llvm-project/commit/9362698450d1843e7fde98d8012a7308244c2d79.diff
LOG: [flang] Change DIE("unreachable") cases to use llvm_unreachable
Reviewers: sscalpone
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79507
Added:
Modified:
flang/lib/Semantics/check-declarations.cpp
flang/lib/Semantics/resolve-names.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp
index 55cf8cdb3896..871bb8283543 100644
--- a/flang/lib/Semantics/check-declarations.cpp
+++ b/flang/lib/Semantics/check-declarations.cpp
@@ -1455,7 +1455,10 @@ void SubprogramMatchHelper::CheckDummyArg(const Symbol &symbol1,
"Dummy argument '%s' is a procedure; the corresponding"
" argument in the interface body is not"_err_en_US);
},
- [&](const auto &, const auto &) { DIE("can't happen"); },
+ [&](const auto &, const auto &) {
+ llvm_unreachable("Dummy arguments are not data objects or"
+ "procedures");
+ },
},
arg1.u, arg2.u);
}
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 4e159b5d2f77..0cf93c6f0344 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -287,7 +287,7 @@ class AttrsVisitor : public virtual BaseVisitor {
case parser::AccessSpec::Kind::Private:
return Attr::PRIVATE;
}
- common::die("unreachable"); // suppress g++ warning
+ llvm_unreachable("Switch covers all cases"); // suppress g++ warning
}
Attr IntentSpecToAttr(const parser::IntentSpec &x) {
switch (x.v) {
@@ -298,7 +298,7 @@ class AttrsVisitor : public virtual BaseVisitor {
case parser::IntentSpec::Intent::InOut:
return Attr::INTENT_INOUT;
}
- common::die("unreachable"); // suppress g++ warning
+ llvm_unreachable("Switch covers all cases"); // suppress g++ warning
}
private:
@@ -1398,13 +1398,27 @@ class ResolveNamesVisitor : public virtual ScopeHandler,
void Post(const parser::AssignedGotoStmt &);
// These nodes should never be reached: they are handled in ProgramUnit
- bool Pre(const parser::MainProgram &) { DIE("unreachable"); }
- bool Pre(const parser::FunctionSubprogram &) { DIE("unreachable"); }
- bool Pre(const parser::SubroutineSubprogram &) { DIE("unreachable"); }
- bool Pre(const parser::SeparateModuleSubprogram &) { DIE("unreachable"); }
- bool Pre(const parser::Module &) { DIE("unreachable"); }
- bool Pre(const parser::Submodule &) { DIE("unreachable"); }
- bool Pre(const parser::BlockData &) { DIE("unreachable"); }
+ bool Pre(const parser::MainProgram &) {
+ llvm_unreachable("This node is handled in ProgramUnit");
+ }
+ bool Pre(const parser::FunctionSubprogram &) {
+ llvm_unreachable("This node is handled in ProgramUnit");
+ }
+ bool Pre(const parser::SubroutineSubprogram &) {
+ llvm_unreachable("This node is handled in ProgramUnit");
+ }
+ bool Pre(const parser::SeparateModuleSubprogram &) {
+ llvm_unreachable("This node is handled in ProgramUnit");
+ }
+ bool Pre(const parser::Module &) {
+ llvm_unreachable("This node is handled in ProgramUnit");
+ }
+ bool Pre(const parser::Submodule &) {
+ llvm_unreachable("This node is handled in ProgramUnit");
+ }
+ bool Pre(const parser::BlockData &) {
+ llvm_unreachable("This node is handled in ProgramUnit");
+ }
void NoteExecutablePartCall(Symbol::Flag, const parser::Call &);
More information about the flang-commits
mailing list