clang 19.0.0git
Public Member Functions | List of all members
clang::SourceRange Class Reference

A trivial tuple used to represent a source range. More...

#include "clang/Basic/SourceLocation.h"

Inheritance diagram for clang::SourceRange:
Inheritance graph
[legend]

Public Member Functions

 SourceRange ()=default
 
 SourceRange (SourceLocation loc)
 
 SourceRange (SourceLocation begin, SourceLocation end)
 
SourceLocation getBegin () const
 
SourceLocation getEnd () const
 
void setBegin (SourceLocation b)
 
void setEnd (SourceLocation e)
 
bool isValid () const
 
bool isInvalid () const
 
bool operator== (const SourceRange &X) const
 
bool operator!= (const SourceRange &X) const
 
bool fullyContains (const SourceRange &other) const
 
void print (raw_ostream &OS, const SourceManager &SM) const
 
std::string printToString (const SourceManager &SM) const
 
void dump (const SourceManager &SM) const
 

Detailed Description

A trivial tuple used to represent a source range.

Definition at line 212 of file SourceLocation.h.

Constructor & Destructor Documentation

◆ SourceRange() [1/3]

clang::SourceRange::SourceRange ( )
default

◆ SourceRange() [2/3]

clang::SourceRange::SourceRange ( SourceLocation  loc)
inline

Definition at line 218 of file SourceLocation.h.

◆ SourceRange() [3/3]

clang::SourceRange::SourceRange ( SourceLocation  begin,
SourceLocation  end 
)
inline

Definition at line 219 of file SourceLocation.h.

Member Function Documentation

◆ dump()

LLVM_DUMP_METHOD void SourceRange::dump ( const SourceManager SM) const

Definition at line 101 of file SourceLocation.cpp.

References print(), and SM.

◆ fullyContains()

bool clang::SourceRange::fullyContains ( const SourceRange other) const
inline

Definition at line 239 of file SourceLocation.h.

◆ getBegin()

SourceLocation clang::SourceRange::getBegin ( ) const
inline

Definition at line 221 of file SourceLocation.h.

Referenced by clang::Sema::ActOnAttributedStmt(), clang::Sema::ActOnBaseSpecifier(), clang::Sema::ActOnComment(), clang::Sema::ActOnCXXNestedNameSpecifier(), clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnLambdaExpressionAfterIntroducer(), clang::Sema::ActOnObjCExceptionDecl(), clang::Sema::actOnObjCTypeArgsAndProtocolQualifiers(), actOnOMPReductionKindClause(), clang::Sema::ActOnOpenMPDeclareSimdDirective(), clang::Sema::ActOnOpenMPLastprivateClause(), clang::Sema::ActOnStartOfLambdaDefinition(), clang::Sema::ActOnSuperClassOfClassInterface(), clang::Sema::ActOnTag(), clang::Sema::ActOnTagFinishDefinition(), clang::Sema::ActOnUsingDeclaration(), addBlockPointerConversion(), clang::ASTContext::addComment(), addFunctionPointerConversion(), clang::PreprocessingRecord::addPreprocessedEntity(), clang::Sema::BuildArrayType(), clang::Sema::BuildAtomicExpr(), clang::Sema::BuildBaseInitializer(), clang::Sema::BuildClassMessage(), clang::Sema::BuildCXXNew(), clang::Sema::BuildCXXTypeConstructExpr(), clang::Sema::BuildDelegatingInitializer(), clang::Sema::BuildImplicitMemberExpr(), buildLambdaCaptureFixit(), clang::Sema::BuildLambdaExpr(), clang::Sema::BuildMemberInitializer(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildObjCArrayLiteral(), clang::Sema::BuildObjCBoxedExpr(), clang::Sema::BuildObjCDictionaryLiteral(), clang::Sema::BuildPseudoDestructorExpr(), clang::Sema::CheckAltivecInitFromScalar(), clang::Sema::CheckCastAlign(), CheckConstraintSatisfaction(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckCountedByAttr(), clang::Sema::CheckExceptionSpecCompatibility(), clang::Sema::CheckExplicitlyDefaultedComparison(), clang::Sema::CheckExtVectorCast(), clang::Sema::checkInitializerLifetime(), checkIntToPointerCast(), clang::Sema::CheckLiteralOperatorDeclaration(), checkLiteralOperatorTemplateParameterList(), clang::Sema::CheckMain(), clang::Sema::CheckMatrixCast(), CheckMemorySizeofForComparison(), clang::Sema::CheckMessageArgumentTypes(), CheckNonTypeTemplatePartialSpecializationArgs(), clang::Sema::CheckObjCConversion(), checkObjCMethodX86VectorTypes(), clang::Sema::checkOpenMPDeclareVariantFunction(), clang::Sema::CheckTemplateArgument(), clang::Sema::CheckTemplateTypeArgument(), clang::Sema::CheckTypenameType(), checkTypeParamListConsistency(), clang::Sema::checkUnknownAnyCast(), clang::Sema::CheckUsingDeclQualifier(), clang::Sema::CheckVectorCast(), comparePiece(), convertTokenRangeToCharRange(), clang::tooling::CodeRangeASTSelection::create(), clang::InitializationKind::CreateCast(), clang::InitializationKind::CreateCStyleCast(), clang::InitializationKind::CreateFunctionalCast(), clang::Sema::CreateGenericSelectionExpr(), clang::Sema::CreateLambdaCallOperator(), clang::Sema::createLambdaClosureType(), clang::Sema::CXXCheckConditionalOperands(), clang::InitializationSequence::Diagnose(), DiagnoseAccessPath(), diagnoseBadCast(), DiagnoseCallingConvCast(), DiagnoseConstAssignment(), clang::Sema::DiagnoseEqualityWithExtraParens(), diagnoseInstanceReference(), DiagnoseInvisibleNamespace(), clang::ODRDiagsEmitter::diagnoseMismatch(), clang::Sema::DiagnoseMultipleMethodInGlobalPool(), DiagnoseNullConversion(), diagnoseObjCARCConversion(), DiagnoseReinterpretUpDownCast(), clang::Sema::diagnoseTypo(), clang::Sema::DiagnoseUnexpandedParameterPack(), clang::Sema::DiagnoseUnknownTypeName(), diagnoseWellFormedUnsatisfiedConstraintExpr(), doRewriteToUTF8StringBoxedExpressionHelper(), clang::TextNodeDumper::dumpSourceRange(), clang::Sema::EnsureTemplateArgumentListConstraints(), clang::BuiltinTypeLoc::expandBuiltinRange(), clang::syntax::TokenBuffer::expandedTokens(), clang::CXXScopeSpec::Extend(), extendLeft(), extendRight(), clang::Declarator::ExtendWithDeclSpec(), clang::tooling::findSelectedASTNodes(), clang::DeclSpec::Finish(), GCRewriteFinalize(), clang::NestedNameSpecifierLoc::getBeginLoc(), clang::TypeLoc::getBeginLoc(), clang::comments::Comment::getBeginLoc(), clang::Decl::getBeginLoc(), clang::RawComment::getBeginLoc(), clang::BuiltinTypeLoc::getBuiltinLoc(), GetDeclSpecTypeForDeclarator(), clang::NonTypeTemplateParmDecl::getDefaultArgumentLoc(), clang::DeclaratorChunk::getFunction(), getGenericLambdaTemplateParameterList(), getLambdaType(), clang::VariableArrayType::getLBracketLoc(), clang::DependentSizedArrayType::getLBracketLoc(), getLengthOnSingleLine(), getLiteralInfo(), clang::AttributeCommonInfo::getLoc(), clang::NestedNameSpecifierLoc::getLocalBeginLoc(), clang::Attr::getLocation(), clang::TemplateArgumentLoc::getLocation(), clang::MacroDefinitionRecord::getLocation(), clang::FunctionDecl::getParametersSourceRange(), clang::format::FormatToken::getPrecedence(), clang::ento::CallEvent::getProgramPoint(), clang::Sema::getTypeName(), clang::DeclSpec::getTypeSpecWidthLoc(), handleAnyX86InterruptAttr(), handleAvailabilityAttr(), clang::VerifyDiagnosticConsumer::HandleComment(), handleDeprecatedAttr(), HandleDestructionImpl(), handleDLLAttr(), handleFallThroughAttr(), handleOpenCLUnrollHint(), handleRISCVInterruptAttr(), handleVisibilityAttr(), clang::ASTImporter::Import(), clang::tooling::RenameOccurrences::initiate(), isPreprocessedEntityIfInFileID(), LookupMemberExpr(), clang::NestedNameSpecifierLocBuilder::MakeTrivial(), clang::ASTUnit::mapRangeFromPreamble(), clang::ASTUnit::mapRangeToPreamble(), mergeInterfaceMethodToImpl(), clang::format::WhitespaceManager::Change::IsBeforeInFile::operator()(), clang::BeforeThanCompare< SourceRange >::operator()(), clang::InitializationSequence::Perform(), clang::Sema::PerformObjectMemberConversion(), populateExecutedLinesWithFunctionSignature(), ProcessStmtAttribute(), clang::RawComment::RawComment(), clang::TreeTransform< Derived >::RebuildArrayType(), clang::Sema::RebuildNestedNameSpecifierInCurrentInstantiation(), clang::Rewriter::ReplaceText(), clang::Sema::RequireCompleteDeclContext(), clang::Sema::ResolveAndFixSingleFunctionTemplateSpecialization(), rewriteToArraySubscriptSet(), rewriteToBoolLiteral(), rewriteToCharLiteral(), rewriteToDictionaryLiteral(), rewriteToDictionarySubscriptSet(), rewriteToNSMacroDecl(), rewriteToNumberLiteral(), rewriteToNumericBoxedExpression(), rewriteToSubscriptGetCommon(), clang::Token::setAnnotationRange(), clang::ForStmt::setConditionVariable(), clang::IfStmt::setConditionVariable(), clang::WhileStmt::setConditionVariable(), clang::SwitchStmt::setConditionVariable(), clang::CXXScopeSpec::SetInvalid(), clang::ObjCMessageExpr::setSourceRange(), SuggestParentheses(), clang::takeAndConcatenateAttrs(), clang::TreeTransform< Derived >::TransformCXXNamedCastExpr(), TryOrBuildParenListInitialization(), TryReinterpretCast(), TryStaticCast(), TryStaticDowncast(), TryStaticImplicitCast(), TryStaticMemberPointerUpcast(), clang::ConversionFixItGenerator::tryToFixConversion(), warnAboutAmbiguousFunction(), and WarnUndefinedMethod().

◆ getEnd()

SourceLocation clang::SourceRange::getEnd ( ) const
inline

Definition at line 222 of file SourceLocation.h.

Referenced by clang::Sema::ActOnCXXForRangeIdentifier(), clang::Sema::ActOnCXXNestedNameSpecifierDecltype(), clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnPseudoDestructorExpr(), clang::Sema::ActOnStartOfLambdaDefinition(), clang::Sema::ActOnSuperClassOfClassInterface(), clang::ASTRecordWriter::AddNestedNameSpecifierLoc(), clang::Sema::BuildAtomicExpr(), clang::Sema::BuildBaseInitializer(), clang::Sema::BuildCompoundLiteralExpr(), clang::Sema::BuildCXXNew(), clang::Sema::BuildCXXTypeConstructExpr(), clang::Sema::BuildDelegatingInitializer(), buildLambdaCaptureFixit(), clang::Sema::BuildLambdaExpr(), buildLambdaThisCaptureFixit(), clang::Sema::BuildMemberInitializer(), clang::Sema::BuildObjCNumericLiteral(), clang::Preprocessor::CheckEndOfDirective(), CheckMemorySizeofForComparison(), clang::Sema::CheckPureMethod(), clang::Sema::CheckTemplateTypeArgument(), comparePiece(), clang::tooling::ExtractionSemicolonPolicy::compute(), ConvertDeducedTemplateArgument(), ConvertDeducedTemplateArguments(), convertTokenRangeToCharRange(), clang::tooling::CodeRangeASTSelection::create(), clang::InitializationKind::CreateCast(), clang::InitializationKind::CreateCStyleCast(), clang::InitializationKind::CreateFunctionalCast(), clang::Sema::CreateUnaryExprOrTypeTraitExpr(), clang::Sema::DiagnoseAssignmentAsCondition(), clang::Sema::DiagnoseEqualityWithExtraParens(), DiagnoseInvalidRedeclaration(), clang::TextNodeDumper::dumpSourceRange(), clang::BuiltinTypeLoc::expandBuiltinRange(), clang::syntax::TokenBuffer::expandedTokens(), extendLeft(), clang::Declarator::ExtendWithDeclSpec(), clang::tooling::findSelectedASTNodes(), fixVarDeclWithArray(), GCRewriteFinalize(), clang::NestedNameSpecifierLoc::getEndLoc(), clang::comments::Comment::getEndLoc(), clang::Decl::getEndLoc(), clang::CXXConstructExpr::getEndLoc(), clang::CXXTemporaryObjectExpr::getEndLoc(), clang::RawComment::getEndLoc(), clang::DeclaratorChunk::getFunction(), getGenericLambdaTemplateParameterList(), getLengthOnSingleLine(), getLiteralInfo(), clang::NestedNameSpecifierLoc::getLocalEndLoc(), clang::FunctionDecl::getParametersSourceRange(), clang::format::FormatToken::getPrecedence(), clang::VariableArrayType::getRBracketLoc(), clang::DependentSizedArrayType::getRBracketLoc(), clang::FunctionDecl::getReturnTypeSourceRange(), clang::ParmVarDecl::getSourceRange(), clang::TagDecl::getSourceRange(), clang::TemplateDecl::getSourceRange(), clang::TemplateTemplateParmDecl::getSourceRange(), clang::ClassTemplateSpecializationDecl::getSourceRange(), clang::VerifyDiagnosticConsumer::HandleComment(), clang::format::FormatToken::hasWhitespaceBefore(), clang::ASTImporter::Import(), LookupMemberExprInRecord(), clang::NestedNameSpecifierLocBuilder::MakeTrivial(), clang::ASTUnit::mapRangeFromPreamble(), clang::ASTUnit::mapRangeToPreamble(), clang::Sema::mergeHLSLParamModifierAttr(), clang::format::WhitespaceManager::Change::IsBeforeInFile::operator()(), clang::InitializationSequence::Perform(), populateExecutedLinesWithFunctionSignature(), clang::RawComment::RawComment(), rewriteToArraySubscriptSet(), rewriteToDictionaryLiteral(), rewriteToDictionarySubscriptSet(), rewriteToSubscriptGetCommon(), clang::Token::setAnnotationRange(), clang::ForStmt::setConditionVariable(), clang::IfStmt::setConditionVariable(), clang::WhileStmt::setConditionVariable(), clang::SwitchStmt::setConditionVariable(), clang::CXXScopeSpec::SetInvalid(), clang::ObjCMessageExpr::setSourceRange(), SuggestParentheses(), clang::takeAndConcatenateAttrs(), clang::Declarator::takeAttributes(), clang::TreeTransform< Derived >::TransformCXXNamedCastExpr(), TryOrBuildParenListInitialization(), clang::ConversionFixItGenerator::tryToFixConversion(), and clang::TemplateDeclInstantiator::VisitFunctionDecl().

◆ isInvalid()

bool clang::SourceRange::isInvalid ( ) const
inline

◆ isValid()

bool clang::SourceRange::isValid ( ) const
inline

◆ operator!=()

bool clang::SourceRange::operator!= ( const SourceRange X) const
inline

Definition at line 234 of file SourceLocation.h.

References X.

◆ operator==()

bool clang::SourceRange::operator== ( const SourceRange X) const
inline

Definition at line 230 of file SourceLocation.h.

References X.

◆ print()

void SourceRange::print ( raw_ostream &  OS,
const SourceManager SM 
) const

Definition at line 136 of file SourceLocation.cpp.

References PrintDifference(), and SM.

Referenced by dump(), and printToString().

◆ printToString()

LLVM_DUMP_METHOD std::string SourceRange::printToString ( const SourceManager SM) const

Definition at line 148 of file SourceLocation.cpp.

References print(), and SM.

Referenced by printIndicesOfElementsToConstructJson(), and printPendingInitLoopJson().

◆ setBegin()

void clang::SourceRange::setBegin ( SourceLocation  b)
inline

◆ setEnd()

void clang::SourceRange::setEnd ( SourceLocation  e)
inline

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