[flang] Change DIE("unreachable") cases to use llvm_unreachable

Reviewers: sscalpone

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79507
This commit is contained in:
David Truby 2020-05-06 18:38:28 +01:00
parent 58610eb368
commit 9362698450
2 changed files with 27 additions and 10 deletions

View file

@ -1455,7 +1455,10 @@ void SubprogramMatchHelper::CheckDummyArg(const Symbol &symbol1,
"Dummy argument '%s' is a procedure; the corresponding" "Dummy argument '%s' is a procedure; the corresponding"
" argument in the interface body is not"_err_en_US); " 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); arg1.u, arg2.u);
} }

View file

@ -287,7 +287,7 @@ protected:
case parser::AccessSpec::Kind::Private: case parser::AccessSpec::Kind::Private:
return Attr::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) { Attr IntentSpecToAttr(const parser::IntentSpec &x) {
switch (x.v) { switch (x.v) {
@ -298,7 +298,7 @@ protected:
case parser::IntentSpec::Intent::InOut: case parser::IntentSpec::Intent::InOut:
return Attr::INTENT_INOUT; return Attr::INTENT_INOUT;
} }
common::die("unreachable"); // suppress g++ warning llvm_unreachable("Switch covers all cases"); // suppress g++ warning
} }
private: private:
@ -1398,13 +1398,27 @@ public:
void Post(const parser::AssignedGotoStmt &); void Post(const parser::AssignedGotoStmt &);
// These nodes should never be reached: they are handled in ProgramUnit // These nodes should never be reached: they are handled in ProgramUnit
bool Pre(const parser::MainProgram &) { DIE("unreachable"); } bool Pre(const parser::MainProgram &) {
bool Pre(const parser::FunctionSubprogram &) { DIE("unreachable"); } llvm_unreachable("This node is handled in ProgramUnit");
bool Pre(const parser::SubroutineSubprogram &) { DIE("unreachable"); } }
bool Pre(const parser::SeparateModuleSubprogram &) { DIE("unreachable"); } bool Pre(const parser::FunctionSubprogram &) {
bool Pre(const parser::Module &) { DIE("unreachable"); } llvm_unreachable("This node is handled in ProgramUnit");
bool Pre(const parser::Submodule &) { DIE("unreachable"); } }
bool Pre(const parser::BlockData &) { DIE("unreachable"); } 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 &); void NoteExecutablePartCall(Symbol::Flag, const parser::Call &);