[PATCH] D145775: Improve documentation of CXIndexOptions; NFC
Igor Kushnir via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 10 01:53:19 PST 2023
vedgy created this revision.
Herald added a subscriber: arphaman.
Herald added a project: All.
vedgy requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Document one more alternative way to initialize struct CXIndexOptions,
which is used in LibclangSetPreambleStoragePathTest since
df8f8f76207df40dca11c9c0c2328d6b3dfba9ca <https://reviews.llvm.org/rGdf8f8f76207df40dca11c9c0c2328d6b3dfba9ca> because the previous
initialization approach causes compiler warnings.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D145775
Files:
clang/include/clang-c/Index.h
Index: clang/include/clang-c/Index.h
===================================================================
--- clang/include/clang-c/Index.h
+++ clang/include/clang-c/Index.h
@@ -329,8 +329,8 @@
* 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 @@
* \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 {
/**
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145775.504057.patch
Type: text/x-patch
Size: 943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230310/93461e51/attachment.bin>
More information about the cfe-commits
mailing list