[clang] 7d11f52 - [clang] Silence GCC warnings about control reaching end of non void function
Martin Storsjö via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 14 14:03:18 PDT 2024
Author: Martin Storsjö
Date: 2024-09-15T00:02:39+03:00
New Revision: 7d11f5249c8068851270e94ac02c180e7b83590d
URL: https://github.com/llvm/llvm-project/commit/7d11f5249c8068851270e94ac02c180e7b83590d
DIFF: https://github.com/llvm/llvm-project/commit/7d11f5249c8068851270e94ac02c180e7b83590d.diff
LOG: [clang] Silence GCC warnings about control reaching end of non void function
This fixes GCC warnings since
e39205654dc11c50bd117e8ccac243a641ebd71f.
Added:
Modified:
clang/include/clang/Basic/DiagnosticIDs.h
clang/lib/Sema/SemaOverload.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/DiagnosticIDs.h b/clang/include/clang/Basic/DiagnosticIDs.h
index 2402996ece5c94..daad66f499538f 100644
--- a/clang/include/clang/Basic/DiagnosticIDs.h
+++ b/clang/include/clang/Basic/DiagnosticIDs.h
@@ -18,6 +18,7 @@
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/ErrorHandling.h"
#include <optional>
#include <vector>
@@ -310,6 +311,7 @@ class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
return {diag::Severity::Fatal, std::string(Message), CLASS_ERROR,
/*ShowInSystemHeader*/ true};
}
+ llvm_unreachable("Fully covered switch above!");
}());
}
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index fbeb6ee5b052f3..d304f322aced64 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -7324,6 +7324,7 @@ static bool diagnoseDiagnoseIfAttrsWith(Sema &S, const NamedDecl *ND,
case DiagnoseIfAttr::DS_error:
return diag::Severity::Error;
}
+ llvm_unreachable("Fully covered switch above!");
};
for (const auto *DIA : llvm::make_range(WarningBegin, Attrs.end()))
More information about the cfe-commits
mailing list