silence -Wreturn-type warnings
authorSaleem Abdulrasool <compnerd@compnerd.org>
Mon, 15 Feb 2016 00:36:52 +0000 (00:36 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Mon, 15 Feb 2016 00:36:52 +0000 (00:36 +0000)
These codepaths would generate warnings with GCC on linux even though the switch
was covered.  Add llvm_unreachable markers to indicate that the switch should be
covered.  NFC.

llvm-svn: 260865

clang/lib/Index/IndexSymbol.cpp
clang/lib/Index/IndexingContext.cpp
clang/tools/libclang/CXIndexDataConsumer.cpp

index bf3bfd1..95ae977 100644 (file)
@@ -266,6 +266,7 @@ StringRef index::getSymbolKindString(SymbolKind K) {
   case SymbolKind::CXXTypeAlias: return "type-alias";
   case SymbolKind::CXXInterface: return "c++-__interface";
   }
+  llvm_unreachable("invalid symbol kind");
 }
 
 StringRef index::getTemplateKindStr(SymbolCXXTemplateKind TK) {
@@ -275,6 +276,7 @@ StringRef index::getTemplateKindStr(SymbolCXXTemplateKind TK) {
   case SymbolCXXTemplateKind::TemplatePartialSpecialization : return "TPS";
   case SymbolCXXTemplateKind::TemplateSpecialization: return "TS";
   }
+  llvm_unreachable("invalid template kind");
 }
 
 StringRef index::getSymbolLanguageString(SymbolLanguage K) {
@@ -283,4 +285,5 @@ StringRef index::getSymbolLanguageString(SymbolLanguage K) {
   case SymbolLanguage::ObjC: return "ObjC";
   case SymbolLanguage::CXX: return "C++";
   }
+  llvm_unreachable("invalid symbol language kind");
 }
index 91fbbfb..9ac22f8 100644 (file)
@@ -135,6 +135,7 @@ bool IndexingContext::isTemplateImplicitInstantiation(const Decl *D) {
     case TSK_ExplicitInstantiationDefinition:
       return true;
   }
+  llvm_unreachable("invalid TemplateSpecializationKind");
 }
 
 bool IndexingContext::shouldIgnoreIfImplicit(const Decl *D) {
index f6f8e30..322725e 100644 (file)
@@ -1263,6 +1263,7 @@ static CXIdxEntityKind getEntityKindFromSymbolKind(SymbolKind K) {
   case SymbolKind::CXXTypeAlias: return CXIdxEntity_CXXTypeAlias;
   case SymbolKind::CXXInterface: return CXIdxEntity_CXXInterface;
   }
+  llvm_unreachable("invalid symbol kind");
 }
 
 static CXIdxEntityCXXTemplateKind
@@ -1275,6 +1276,7 @@ getEntityKindFromSymbolCXXTemplateKind(SymbolCXXTemplateKind K) {
   case SymbolCXXTemplateKind::TemplateSpecialization:
     return CXIdxEntity_TemplateSpecialization;
   }
+  llvm_unreachable("invalid template kind");
 }
 
 static CXIdxEntityLanguage getEntityLangFromSymbolLang(SymbolLanguage L) {
@@ -1283,4 +1285,5 @@ static CXIdxEntityLanguage getEntityLangFromSymbolLang(SymbolLanguage L) {
   case SymbolLanguage::ObjC: return CXIdxEntityLang_ObjC;
   case SymbolLanguage::CXX: return CXIdxEntityLang_CXX;
   }
+  llvm_unreachable("invalid symbol language");
 }