[clang] 00e5258 - Improve documentation of CXIndexOptions; NFC

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 10 06:22:17 PST 2023


Author: Igor Kushnir
Date: 2023-03-10T09:22:09-05:00
New Revision: 00e52588f02e2d9c7fcd1cfb4703deaca1b32a8d

URL: https://github.com/llvm/llvm-project/commit/00e52588f02e2d9c7fcd1cfb4703deaca1b32a8d
DIFF: https://github.com/llvm/llvm-project/commit/00e52588f02e2d9c7fcd1cfb4703deaca1b32a8d.diff

LOG: 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

Added: 
    

Modified: 
    clang/include/clang-c/Index.h

Removed: 
    


################################################################################
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 {
   /**


        


More information about the cfe-commits mailing list