clang  6.0.0svn
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 "/opt/doxygen-docs/src/llvm/tools/clang/lib/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. More...
 

Detailed Description

Determines which semicolons should be inserted during extraction.

Definition at line 25 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 69 of file SourceExtraction.cpp.

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

Referenced by isNeededInOriginalFunction().

◆ isNeededInExtractedFunction()

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

Definition at line 27 of file SourceExtraction.h.

◆ isNeededInOriginalFunction()

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

Definition at line 31 of file SourceExtraction.h.

References compute().


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