Skip to content

Commit

Permalink
Improve documentation of CXIndexOptions; NFC
Browse files Browse the repository at this point in the history
Document one more alternative way to initialize struct CXIndexOptions,
which is used in LibclangSetPreambleStoragePathTest since
df8f8f7 because the previous
initialization approach causes compiler warnings.

Differential Revision: https://reviews.llvm.org/D145775
  • Loading branch information
vedgy authored and AaronBallman committed Mar 10, 2023
1 parent ecf6508 commit 00e5258
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions clang/include/clang-c/Index.h
Expand Up @@ -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));
Expand All @@ -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 {
/**
Expand Down

0 comments on commit 00e5258

Please sign in to comment.