[flang-commits] [flang] f92f775 - [flang][NFC] Address reported "possible missing return" (#86523)
via flang-commits
flang-commits at lists.llvm.org
Tue Mar 26 10:02:26 PDT 2024
Author: Peter Klausler
Date: 2024-03-26T10:02:22-07:00
New Revision: f92f77521263c8f20171b62688ecc86de9c9dfa9
URL: https://github.com/llvm/llvm-project/commit/f92f77521263c8f20171b62688ecc86de9c9dfa9
DIFF: https://github.com/llvm/llvm-project/commit/f92f77521263c8f20171b62688ecc86de9c9dfa9.diff
LOG: [flang][NFC] Address reported "possible missing return" (#86523)
A function uses "if constexpr" to consider all possible types in a
variant, but looks as if it can fall out without returning an
expression. Add a final "else" with a crash to make things more clear
and to protect against unlikely future extensions of the type.
Fixes https://github.com/llvm/llvm-project/issues/86391.
Added:
Modified:
flang/lib/Semantics/tools.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/tools.cpp b/flang/lib/Semantics/tools.cpp
index 2230047abd7220..654ebb1fa335dc 100644
--- a/flang/lib/Semantics/tools.cpp
+++ b/flang/lib/Semantics/tools.cpp
@@ -1287,6 +1287,8 @@ static bool StopAtComponentPre(const Symbol &component) {
return !IsPointer(component);
} else if constexpr (componentKind == ComponentKind::PotentialAndPointer) {
return true;
+ } else {
+ DIE("unexpected ComponentKind");
}
}
More information about the flang-commits
mailing list