clang 20.0.0git
Public Member Functions | Static Public Member Functions | List of all members
clang::tooling::ExtractionSemicolonPolicy Class Reference

Determines which semicolons should be inserted during extraction. More...

#include "clang/Tooling/Refactoring/Extract/SourceExtraction.h"

Public Member Functions

bool isNeededInExtractedFunction () const
 
bool isNeededInOriginalFunction () const
 

Static Public Member Functions

static ExtractionSemicolonPolicy compute (const Stmt *S, SourceRange &ExtractedRange, const SourceManager &SM, const LangOptions &LangOpts)
 Returns the semicolon insertion policy that is needed for extraction of the given statement from the given source range.
 

Detailed Description

Determines which semicolons should be inserted during extraction.

Definition at line 24 of file SourceExtraction.h.

Member Function Documentation

◆ compute()

ExtractionSemicolonPolicy clang::tooling::ExtractionSemicolonPolicy::compute ( const Stmt S,
SourceRange ExtractedRange,
const SourceManager SM,
const LangOptions LangOpts 
)
static

Returns the semicolon insertion policy that is needed for extraction of the given statement from the given source range.

The extracted expression should be terminated with a ';'. The call to the extracted function will replace this expression, so it won't need a terminating ';'.

Some statements don't need to be terminated with ';'. The call to the extracted function will be a standalone statement, so it should be terminated with a ';'.

Some statements might end at ';'. The extraction will move that ';', so the call to the extracted function should be terminated with a ';'.

Other statements should generally have a trailing ';'. We can try to find it and move it together it with the extracted code.

Otherwise insert semicolons in both places.

Definition at line 73 of file SourceExtraction.cpp.

References clang::Lexer::findNextToken(), clang::SourceRange::getEnd(), clang::SourceRange::setEnd(), and SM.

◆ isNeededInExtractedFunction()

bool clang::tooling::ExtractionSemicolonPolicy::isNeededInExtractedFunction ( ) const
inline

Definition at line 26 of file SourceExtraction.h.

◆ isNeededInOriginalFunction()

bool clang::tooling::ExtractionSemicolonPolicy::isNeededInOriginalFunction ( ) const
inline

Definition at line 30 of file SourceExtraction.h.


The documentation for this class was generated from the following files: