r322845 - Fix MSVC "uninitialized variable" warning.

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 05:28:54 PST 2018


Author: rksimon
Date: Thu Jan 18 05:28:54 2018
New Revision: 322845

URL: http://llvm.org/viewvc/llvm-project?rev=322845&view=rev
Log:
Fix MSVC "uninitialized variable" warning.

Modified:
    cfe/trunk/tools/c-index-test/c-index-test.c

Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=322845&r1=322844&r2=322845&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Thu Jan 18 05:28:54 2018
@@ -739,7 +739,10 @@ static CXString CursorToText(CXCursor Cu
   }
   }
   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) {




More information about the cfe-commits mailing list