clang 19.0.0git
Public Member Functions | Public Attributes | List of all members
clang::Rewriter::RewriteOptions Struct Reference

#include "clang/Rewrite/Core/Rewriter.h"

Public Member Functions

 RewriteOptions ()
 

Public Attributes

bool IncludeInsertsAtBeginOfRange = true
 Given a source range, true to include previous inserts at the beginning of the range as part of the range itself (true by default).
 
bool IncludeInsertsAtEndOfRange = true
 Given a source range, true to include previous inserts at the end of the range as part of the range itself (true by default).
 
bool RemoveLineIfEmpty = false
 If true and removing some text leaves a blank line also remove the empty line (false by default).
 

Detailed Description

Definition at line 38 of file Rewriter.h.

Constructor & Destructor Documentation

◆ RewriteOptions()

clang::Rewriter::RewriteOptions::RewriteOptions ( )
inline

Definition at line 62 of file Rewriter.h.

Member Data Documentation

◆ IncludeInsertsAtBeginOfRange

bool clang::Rewriter::RewriteOptions::IncludeInsertsAtBeginOfRange = true

Given a source range, true to include previous inserts at the beginning of the range as part of the range itself (true by default).

Definition at line 41 of file Rewriter.h.

Referenced by clang::Rewriter::getRangeSize(), and clang::Rewriter::InsertTextAfterToken().

◆ IncludeInsertsAtEndOfRange

bool clang::Rewriter::RewriteOptions::IncludeInsertsAtEndOfRange = true

Given a source range, true to include previous inserts at the end of the range as part of the range itself (true by default).

Definition at line 45 of file Rewriter.h.

Referenced by clang::Rewriter::getRangeSize().

◆ RemoveLineIfEmpty

bool clang::Rewriter::RewriteOptions::RemoveLineIfEmpty = false

If true and removing some text leaves a blank line also remove the empty line (false by default).

FIXME: This sometimes corrupts the file's rewrite buffer due to incorrect indexing in the implementation (see the FIXME in clang::RewriteBuffer::RemoveText). Moreover, it's inefficient because it must scan the buffer from the beginning to find the start of the line. When feasible, it's better for the caller to check for a blank line and then, if found, expand the removal range to include it. Checking for a blank line is easy if, for example, the caller can guarantee this is the first edit of a line. In that case, it can just scan before and after the removal range until the next newline or begin/end of the input.

Definition at line 60 of file Rewriter.h.

Referenced by clang::Rewriter::RemoveText().


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