]> granicus.if.org Git - clang/commitdiff
Fix MSVC "uninitialized variable" warning.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 18 Jan 2018 13:28:54 +0000 (13:28 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 18 Jan 2018 13:28:54 +0000 (13:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322845 91177308-0d34-0410-b5e6-96231b3b80d8

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

index ceb2ef6be4e44429ef5feb95be20473aceea5329..d030bbff2e3a2cd27f5e1538c6aa2312ba532c6d 100644 (file)
@@ -739,7 +739,10 @@ static CXString CursorToText(CXCursor Cursor) {
   }
   }
   assert(0 && "unknown display type"); /* no llvm_unreachable in C. */
-  return /*garbage*/ text;
+  // Set to NULL to prevent uninitialized variable warnings.
+  text.data = NULL;
+  text.private_flags = 0;
+  return text;
 }
 
 static void PrintCursor(CXCursor Cursor, const char *CommentSchemaFile) {