From 00e52588f02e2d9c7fcd1cfb4703deaca1b32a8d Mon Sep 17 00:00:00 2001 From: Igor Kushnir Date: Fri, 10 Mar 2023 09:21:33 -0500 Subject: [PATCH] Improve documentation of CXIndexOptions; NFC Document one more alternative way to initialize struct CXIndexOptions, which is used in LibclangSetPreambleStoragePathTest since df8f8f76207df40dca11c9c0c2328d6b3dfba9ca because the previous initialization approach causes compiler warnings. Differential Revision: https://reviews.llvm.org/D145775 --- clang/include/clang-c/Index.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index b986d29235903..7c662c002c26b 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -329,8 +329,8 @@ typedef enum { * Index initialization options. * * 0 is the default value of each member of this struct except for Size. - * Initialize the struct in one of the following two ways to avoid adapting code - * each time a new member is added to it: + * Initialize the struct in one of the following three ways to avoid adapting + * code each time a new member is added to it: * \code * CXIndexOptions Opts; * memset(&Opts, 0, sizeof(Opts)); @@ -340,6 +340,11 @@ typedef enum { * \code * CXIndexOptions Opts = { sizeof(CXIndexOptions) }; * \endcode + * or to prevent the -Wmissing-field-initializers warning for the above version: + * \code + * CXIndexOptions Opts{}; + * Opts.Size = sizeof(CXIndexOptions); + * \endcode */ typedef struct CXIndexOptions { /**