clang-tools 20.0.0git
Public Member Functions | Public Attributes | List of all members
clang::tidy::utils::BraceInsertionHints Struct Reference

A provider of fix-it hints to insert opening and closing braces. More...

#include <BracesAroundStatement.h>

Public Member Functions

 BraceInsertionHints ()=default
 Constructor for a no-hint.
 
 BraceInsertionHints (SourceLocation DiagnosticPos)
 Constructor for a valid hint that cannot insert braces automatically.
 
 BraceInsertionHints (SourceLocation OpeningBracePos, SourceLocation ClosingBracePos, std::string ClosingBrace)
 Constructor for a hint offering fix-its for brace insertion.
 
 operator bool () const
 Indicates whether the hint provides at least the position of a diagnostic.
 
bool offersFixIts () const
 Indicates whether the hint provides fix-its to insert braces.
 
unsigned resultingCompoundLineExtent (const SourceManager &SourceMgr) const
 The number of lines between the inserted opening brace and its closing counterpart.
 
FixItHint openingBraceFixIt () const
 Fix-it to insert an opening brace.
 
FixItHint closingBraceFixIt () const
 Fix-it to insert a closing brace.
 

Public Attributes

SourceLocation DiagnosticPos
 The position of a potential diagnostic.
 

Detailed Description

A provider of fix-it hints to insert opening and closing braces.

An instance of this type is the result of calling getBraceInsertionsHints below.

Definition at line 23 of file BracesAroundStatement.h.

Constructor & Destructor Documentation

◆ BraceInsertionHints() [1/3]

clang::tidy::utils::BraceInsertionHints::BraceInsertionHints ( )
default

Constructor for a no-hint.

◆ BraceInsertionHints() [2/3]

clang::tidy::utils::BraceInsertionHints::BraceInsertionHints ( SourceLocation  DiagnosticPos)
inline

Constructor for a valid hint that cannot insert braces automatically.

Definition at line 33 of file BracesAroundStatement.h.

◆ BraceInsertionHints() [3/3]

clang::tidy::utils::BraceInsertionHints::BraceInsertionHints ( SourceLocation  OpeningBracePos,
SourceLocation  ClosingBracePos,
std::string  ClosingBrace 
)
inline

Constructor for a hint offering fix-its for brace insertion.

Both positions must be valid.

Definition at line 38 of file BracesAroundStatement.h.

References offersFixIts().

Member Function Documentation

◆ closingBraceFixIt()

FixItHint clang::tidy::utils::BraceInsertionHints::closingBraceFixIt ( ) const

Fix-it to insert a closing brace.

Definition at line 42 of file BracesAroundStatement.cpp.

◆ offersFixIts()

bool clang::tidy::utils::BraceInsertionHints::offersFixIts ( ) const

Indicates whether the hint provides fix-its to insert braces.

Definition at line 26 of file BracesAroundStatement.cpp.

Referenced by BraceInsertionHints().

◆ openingBraceFixIt()

FixItHint clang::tidy::utils::BraceInsertionHints::openingBraceFixIt ( ) const

Fix-it to insert an opening brace.

Definition at line 36 of file BracesAroundStatement.cpp.

◆ operator bool()

clang::tidy::utils::BraceInsertionHints::operator bool ( ) const

Indicates whether the hint provides at least the position of a diagnostic.

Definition at line 24 of file BracesAroundStatement.cpp.

◆ resultingCompoundLineExtent()

unsigned clang::tidy::utils::BraceInsertionHints::resultingCompoundLineExtent ( const SourceManager &  SourceMgr) const

The number of lines between the inserted opening brace and its closing counterpart.

Definition at line 30 of file BracesAroundStatement.cpp.

Member Data Documentation

◆ DiagnosticPos

SourceLocation clang::tidy::utils::BraceInsertionHints::DiagnosticPos

The position of a potential diagnostic.

It coincides with the position of the opening brace to insert, but can also just be the place to show a diagnostic in case braces cannot be inserted automatically.

Definition at line 27 of file BracesAroundStatement.h.


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