r260865 - silence -Wreturn-type warnings

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 14 16:36:52 PST 2016


Author: compnerd
Date: Sun Feb 14 18:36:52 2016
New Revision: 260865

URL: http://llvm.org/viewvc/llvm-project?rev=260865&view=rev
Log:
silence -Wreturn-type warnings

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.

Modified:
    cfe/trunk/lib/Index/IndexSymbol.cpp
    cfe/trunk/lib/Index/IndexingContext.cpp
    cfe/trunk/tools/libclang/CXIndexDataConsumer.cpp

Modified: cfe/trunk/lib/Index/IndexSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexSymbol.cpp?rev=260865&r1=260864&r2=260865&view=diff
==============================================================================
--- cfe/trunk/lib/Index/IndexSymbol.cpp (original)
+++ cfe/trunk/lib/Index/IndexSymbol.cpp Sun Feb 14 18:36:52 2016
@@ -266,6 +266,7 @@ StringRef index::getSymbolKindString(Sym
   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(Symb
   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
   case SymbolLanguage::ObjC: return "ObjC";
   case SymbolLanguage::CXX: return "C++";
   }
+  llvm_unreachable("invalid symbol language kind");
 }

Modified: cfe/trunk/lib/Index/IndexingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexingContext.cpp?rev=260865&r1=260864&r2=260865&view=diff
==============================================================================
--- cfe/trunk/lib/Index/IndexingContext.cpp (original)
+++ cfe/trunk/lib/Index/IndexingContext.cpp Sun Feb 14 18:36:52 2016
@@ -135,6 +135,7 @@ bool IndexingContext::isTemplateImplicit
     case TSK_ExplicitInstantiationDefinition:
       return true;
   }
+  llvm_unreachable("invalid TemplateSpecializationKind");
 }
 
 bool IndexingContext::shouldIgnoreIfImplicit(const Decl *D) {

Modified: cfe/trunk/tools/libclang/CXIndexDataConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXIndexDataConsumer.cpp?rev=260865&r1=260864&r2=260865&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXIndexDataConsumer.cpp (original)
+++ cfe/trunk/tools/libclang/CXIndexDataConsumer.cpp Sun Feb 14 18:36:52 2016
@@ -1263,6 +1263,7 @@ static CXIdxEntityKind getEntityKindFrom
   case SymbolKind::CXXTypeAlias: return CXIdxEntity_CXXTypeAlias;
   case SymbolKind::CXXInterface: return CXIdxEntity_CXXInterface;
   }
+  llvm_unreachable("invalid symbol kind");
 }
 
 static CXIdxEntityCXXTemplateKind
@@ -1275,6 +1276,7 @@ getEntityKindFromSymbolCXXTemplateKind(S
   case SymbolCXXTemplateKind::TemplateSpecialization:
     return CXIdxEntity_TemplateSpecialization;
   }
+  llvm_unreachable("invalid template kind");
 }
 
 static CXIdxEntityLanguage getEntityLangFromSymbolLang(SymbolLanguage L) {
@@ -1283,4 +1285,5 @@ static CXIdxEntityLanguage getEntityLang
   case SymbolLanguage::ObjC: return CXIdxEntityLang_ObjC;
   case SymbolLanguage::CXX: return CXIdxEntityLang_CXX;
   }
+  llvm_unreachable("invalid symbol language");
 }




More information about the cfe-commits mailing list