]> granicus.if.org Git - clang/commitdiff
Basic: fix warnings from GCC
authorSaleem Abdulrasool <compnerd@compnerd.org>
Thu, 12 Jun 2014 17:43:37 +0000 (17:43 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Thu, 12 Jun 2014 17:43:37 +0000 (17:43 +0000)
tools/clang/lib/Basic/DiagnosticIDs.cpp: In function ‘clang::DiagnosticIDs::Level toLevel(clang::diag::Severity)’:
tools/clang/lib/Basic/DiagnosticIDs.cpp:382:1: warning: control reaches end of non-void function [-Wreturn-type]

tools/clang/lib/Format/Format.cpp: In member function ‘virtual std::string clang::format::ParseErrorCategory::message(int) const’:
tools/clang/lib/Format/Format.cpp:282:1: warning: control reaches end of non-void function [-Wreturn-type]

Add a default cases that asserts that we handle the severity, parse error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210804 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/DiagnosticIDs.cpp
lib/Format/Format.cpp

index 0bf4355770d34184b76103de793e196b2024a6c2..0b3627eb1c090ae8eb66fb2fe9e94ed37dd88e07 100644 (file)
@@ -368,6 +368,7 @@ StringRef DiagnosticIDs::getDescription(unsigned DiagID) const {
 
 static DiagnosticIDs::Level toLevel(diag::Severity SV) {
   switch (SV) {
+  default: llvm_unreachable("unexpected severity");
   case diag::Severity::Ignored:
     return DiagnosticIDs::Ignored;
   case diag::Severity::Remark:
index 176cb49df8ed1439ea0dd7aec7d0a85245b01df1..e1ec2517b483b51613dbf5c00aa1eb110de318c3 100644 (file)
@@ -272,6 +272,7 @@ const char *ParseErrorCategory::name() const LLVM_NOEXCEPT {
 
 std::string ParseErrorCategory::message(int EV) const {
   switch (static_cast<ParseError>(EV)) {
+  default: llvm_unreachable("unexpected parse error");
   case ParseError::Success:
     return "Success";
   case ParseError::Error: