clang-tools 20.0.0git
Public Attributes | List of all members
clang::clangd::DirectiveTree::Conditional Struct Reference

A preprocessor conditional section. More...

#include <DirectiveTree.h>

Public Attributes

std::vector< std::pair< Directive, DirectiveTree > > Branches
 The sequence of directives that introduce top-level alternative parses.
 
Directive End
 The directive terminating the conditional, should be #endif.
 
std::optional< unsigned > Taken
 The index of the conditional branch we chose as active.
 

Detailed Description

A preprocessor conditional section.

This starts with an #if, #ifdef, #ifndef etc directive. It covers all #else branches, and spans until the matching #endif.

Definition at line 74 of file DirectiveTree.h.

Member Data Documentation

◆ Branches

std::vector<std::pair<Directive, DirectiveTree> > clang::clangd::DirectiveTree::Conditional::Branches

The sequence of directives that introduce top-level alternative parses.

The first branch will have an #if type directive. Subsequent branches will have #else type directives.

Definition at line 79 of file DirectiveTree.h.

◆ End

Directive clang::clangd::DirectiveTree::Conditional::End

The directive terminating the conditional, should be #endif.

Definition at line 81 of file DirectiveTree.h.

◆ Taken

std::optional<unsigned> clang::clangd::DirectiveTree::Conditional::Taken

The index of the conditional branch we chose as active.

std::nullopt indicates no branch was taken (e.g. #if 0 ... #endif). The initial tree from parse() has no branches marked as taken. See chooseConditionalBranches().

Definition at line 86 of file DirectiveTree.h.


The documentation for this struct was generated from the following file: