]> granicus.if.org Git - clang/commitdiff
[Index] Fix GCC warning. This is silly, but no llvm_unreachable and no C99.
authorSam McCall <sam.mccall@gmail.com>
Wed, 17 Jan 2018 15:57:14 +0000 (15:57 +0000)
committerSam McCall <sam.mccall@gmail.com>
Wed, 17 Jan 2018 15:57:14 +0000 (15:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322672 91177308-0d34-0410-b5e6-96231b3b80d8

tools/c-index-test/c-index-test.c

index 0b66eff078985f56f4dba0118b5424c0965af81b..79b3a74b7c96b18d86442942eff401a7fe4ac000 100644 (file)
@@ -724,13 +724,13 @@ static int lineCol_cmp(const void *p1, const void *p2) {
 }
 
 static CXString CursorToText(CXCursor Cursor) {
+  CXString text;
   switch (wanted_display_type) {
   case DisplayType_Spelling:
     return clang_getCursorSpelling(Cursor);
   case DisplayType_DisplayName:
     return clang_getCursorDisplayName(Cursor);
   case DisplayType_Pretty: {
-    CXString text;
     CXPrintingPolicy Policy = clang_getCursorPrintingPolicy(Cursor);
     ModifyPrintingPolicyAccordingToEnv(Policy);
     text = clang_getCursorPrettyPrinted(Cursor, Policy);
@@ -738,6 +738,8 @@ static CXString CursorToText(CXCursor Cursor) {
     return text;
   }
   }
+  assert(0 && "unknown display type"); // no llvm_unreachable in C.
+  return text;                         // garbage
 }
 
 static void PrintCursor(CXCursor Cursor, const char *CommentSchemaFile) {