clang: clang::SourceLocation Class Reference (original) (raw)
Encodes a location in the source.
The SourceManager can decode this to get at the full include stack, line and column information.
Technically, a source location is simply an offset into the manager's view of the input source, which is all input buffers (including macro expansions) concatenated in an effectively arbitrary order. The manager actually maintains two blocks of input buffers. One, starting at offset 0 and growing upwards, contains all buffers from this module. The other, starting at the highest possible offset and growing downwards, contains buffers of loaded modules.
In addition, one bit of SourceLocation is used for quick access to the information whether the location is in a file or a macro expansion.
It is important that this type remains small. It is currently 32 bits wide.
Definition at line 88 of file SourceLocation.h.
bool clang::SourceLocation::isValid ( ) const | inline |
---|
Return true if this is a valid SourceLocation object.
Invalid SourceLocations are often used when events have no corresponding location in the source (e.g. a diagnostic is required for a command line option).
Definition at line 113 of file SourceLocation.h.
References ID.
Referenced by clang::Sema::ActOnAliasDeclaration(), clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnCXXForRangeIdentifier(), clang::Sema::ActOnCXXMemberDeclarator(), clang::Sema::ActOnCXXTryBlock(), clang::Sema::ActOnDecompositionDeclarator(), clang::Sema::ActOnFinishExportDecl(), clang::Sema::ActOnFinishLinkageSpecification(), clang::SemaOpenACC::ActOnForStmtEnd(), clang::Sema::ActOnFriendTypeDecl(), clang::Sema::ActOnGCCAsmStmt(), clang::Sema::ActOnIdExpression(), clang::Sema::ActOnInitList(), clang::Sema::ActOnLambdaClosureQualifiers(), clang::Sema::ActOnModuleDecl(), clang::Sema::ActOnModuleImport(), clang::SemaObjC::ActOnObjCAtTryStmt(), clang::SemaObjC::actOnObjCTypeArgsOrProtocolQualifiers(), clang::SemaOpenMP::ActOnOMPArraySectionExpr(), clang::SemaOpenMP::ActOnOpenMPCriticalDirective(), clang::SemaOpenMP::ActOnOpenMPDeviceClause(), clang::SemaOpenMP::ActOnOpenMPGrainsizeClause(), clang::SemaOpenMP::ActOnOpenMPLastprivateClause(), clang::SemaOpenMP::ActOnOpenMPLinearClause(), clang::SemaOpenMP::ActOnOpenMPNumTasksClause(), clang::SemaOpenMP::ActOnOpenMPOrderClause(), clang::SemaOpenMP::ActOnOpenMPOrderedClause(), clang::SemaOpenMP::ActOnOpenMPReductionClause(), clang::Sema::ActOnPragmaFPValueChangingOption(), clang::SemaObjC::ActOnPropertyImplDecl(), clang::Sema::ActOnReturnStmt(), clang::Sema::ActOnSEHTryBlock(), clang::Sema::ActOnStartCXXMemberDeclarations(), clang::Sema::ActOnStartLinkageSpecification(), clang::Sema::ActOnStartNamespaceDef(), clang::Sema::ActOnTag(), clang::Sema::ActOnTemplateName(), clang::Sema::ActOnTemplateParameterList(), clang::Sema::ActOnTemplateTemplateParameter(), clang::Sema::ActOnTemplateTypeArgument(), clang::Sema::ActOnTypenameType(), clang::Sema::ActOnTypeParameter(), clang::Sema::ActOnUsingDeclaration(), clang::Sema::ActOnUsingDirective(), clang::Sema::ActOnVarTemplateSpecialization(), addConstevalToLambdaDeclSpecifier(), addConstexprToLambdaDeclSpecifier(), addEdgeToPath(), clang::ento::PathDiagnosticPiece::addRange(), clang::Sema::AddRangeBasedOptnone(), addStaticToLambdaDeclSpecifier(), assignInheritanceModel(), clang::ASTContext::attachCommentsToJustParsedDecls(), clang::Sema::BuildBaseInitializer(), clang::Sema::BuildCaptureInit(), clang::SemaObjC::BuildClassMessage(), clang::SemaObjC::BuildClassMessageImplicit(), clang::Sema::BuildCXXForRangeStmt(), clang::Sema::BuildCXXFunctionalCastExpr(), clang::Sema::BuildExprRequirement(), clang::SemaObjC::BuildInstanceMessage(), clang::Sema::buildLambdaInitCaptureInitialization(), clang::Sema::BuildMemberPointerType(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildMemInitializer(), clang::Sema::BuildPointerType(), clang::Sema::BuildPossibleImplicitMemberExpr(), clang::Sema::BuildQualifiedTemplateIdExpr(), BuildRecoveryCallExpr(), clang::Sema::BuildReferenceType(), clang::Sema::BuildTemplateIdExpr(), clang::Sema::BuildTypeConstraint(), clang::Sema::BuildUsingDeclaration(), clang::ento::ObjCMethodCall::canBeOverridenInSubclass(), checkARCPropertyImpl(), clang::Sema::CheckBaseSpecifier(), clang::Sema::CheckClassTemplate(), CheckConstexprDeclStmt(), CheckConstexprFunctionBody(), CheckConstexprFunctionStmt(), clang::SemaOpenMP::checkDeclIsAllowedInOpenMPTarget(), clang::Sema::CheckEquivalentExceptionSpec(), clang::CheckEquivalentExceptionSpecImpl(), clang::Sema::CheckExceptionSpecSubset(), clang::Sema::CheckExplicitlyDefaultedComparison(), clang::Sema::CheckExplicitlyDefaultedSpecialMember(), CheckExplicitObjectParameter(), checkExportedDecl(), clang::sema::checkExprLifetimeImpl(), clang::Sema::CheckFunctionConstraints(), checkIsValidOpenCLKernelParameter(), checkModuleImportContext(), clang::Preprocessor::checkModuleIsAvailable(), checkNestingOfRegions(), clang::Sema::checkNonTrivialCUnionInInitializer(), checkOMPArraySectionConstantForReduction(), clang::Sema::CheckPureMethod(), checkReturnStmtInCoroutine(), checkScheduleModifiers(), clang::Sema::CheckSpecializationInstantiationRedecl(), CheckSYCLKernelName(), CheckTemplateArgumentAddressOfObjectOrFunction(), clang::Sema::CheckTypeConstraint(), clang::Sema::CheckTypenameType(), checkUndefinedButUsed(), compare(), compareCrossTUSourceLocs(), compileModule(), ComputeDefaultedComparisonExceptionSpec(), clang::Lexer::ComputePreamble(), clang::ento::bugreporter::StoreHandler::constructNote(), clang::NoSanitizeList::containsLocation(), clang::MemberExpr::Create(), clang::UnresolvedMemberExpr::Create(), clang::UnresolvedLookupExpr::Create(), clang::DependentScopeDeclRefExpr::Create(), clang::DeclRefExpr::Create(), clang::CXXDependentScopeMemberExpr::Create(), clang::Sema::CreateBuiltinUnaryOp(), clang::ento::PathDiagnosticLocation::createMemberLoc(), clang::Preprocessor::CreateString(), clang::CXXMethodDecl::CXXMethodDecl(), clang::Sema::DefineDefaultedComparison(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitMoveAssignment(), DetectPrecisionLossInComplexDivision(), DiagLocForExplicitInstantiation(), clang::Sema::DiagnoseAbsenceOfOverrideControl(), DiagnosedUnqualifiedCallsToStdFunctions(), clang::Sema::diagnoseIgnoredQualifiers(), DiagnoseMismatchedNewDelete(), diagnoseObjCARCConversion(), clang::SemaObjC::DiagnoseOwningPropertyGetterSynthesis(), clang::Sema::DiagnosePrecisionLossInComplexDivision(), clang::Sema::diagnoseQualifiedDeclaration(), clang::Sema::DiagnoseShadowingLambdaDecls(), DiagnoseStaticSpecifierRestrictions(), DiagnoseTemplateParameterListArityMismatch(), clang::Sema::DiagnoseUnterminatedPragmaAlignPack(), clang::Sema::DiagnoseUseOfDecl(), clang::BackendConsumer::DontCallDiagHandler(), clang::CodeGen::CGOpenMPRuntime::emitCall(), clang::CodeGen::CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(), clang::DiagnosticRenderer::emitDiagnostic(), clang::TextDiagnostic::emitDiagnosticLoc(), clang::TextDiagnostic::emitDiagnosticMessage(), clang::CodeGen::CGDebugInfo::emitFunctionStart(), emitNullabilityConsistencyWarning(), clang::CodeGen::CGDebugInfo::EmitUsingDirective(), EvaluateDefined(), clang::BuiltinTypeLoc::expandBuiltinRange(), clang::NestedNameSpecifierLocBuilder::Extend(), clang::sema::SemaPPCallbacks::FileChanged(), clang::syntax::FileRange::FileRange(), clang::MacroDirective::findDirectiveAtLoc(), fixItNullability(), fixLocalVarDeclWithSpan(), formImmediatelyDeclaredConstraint(), clang::index::generateUSRForMacro(), clang::TypeLoc::getBeginLoc(), clang::MemberExpr::getBeginLoc(), clang::DesignatedInitExpr::getBeginLoc(), clang::CXXFoldExpr::getBeginLoc(), clang::FullSourceLoc::getBufferData(), clang::FullSourceLoc::getCharacterData(), clang::FullSourceLoc::getColumnNumber(), clang::SourceManager::getDecomposedIncludedLoc(), getEndCharLoc(), clang::ConceptReference::getEndLoc(), clang::DeclarationNameInfo::getEndLoc(), clang::CXXConstructExpr::getEndLoc(), clang::CXXFunctionalCastExpr::getEndLoc(), clang::CXXUnresolvedConstructExpr::getEndLoc(), clang::CXXFoldExpr::getEndLoc(), getEntityEndLoc(), clang::FullSourceLoc::getExpansionColumnNumber(), clang::FullSourceLoc::getExpansionLineNumber(), clang::FullSourceLoc::getExpansionLoc(), clang::CXXMemberCallExpr::getExprLoc(), clang::SourceManager::getFileCharacteristic(), clang::FullSourceLoc::getFileEntry(), clang::FullSourceLoc::getFileEntryRef(), clang::FullSourceLoc::getFileID(), clang::FullSourceLoc::getFileLoc(), clang::FullSourceLoc::getFileOffset(), clang::sema::FunctionScopeInfo::getFirstCoroutineStmtKeyword(), GetFullTypeForDeclarator(), clang::DeclaratorChunk::getFunction(), clang::AnalysisDeclContext::getFunctionName(), clang::FullSourceLoc::getImmediateMacroCallerLoc(), clang::Preprocessor::getLastMacroWithSpelling(), getLastStmtLoc(), clang::FullSourceLoc::getLineNumber(), clang::CIRGen::CIRGenModule::getLoc(), clang::AutoTypeLoc::getLocalSourceRange(), clang::SourceManager::getMacroArgExpandedLocation(), clang::FullSourceLoc::getModuleImportLoc(), clang::tooling::getNamedDeclAt(), clang::FunctionDecl::getParametersSourceRange(), getPastLoc(), getPointeeTypeText(), clang::FullSourceLoc::getPresumedLoc(), clang::ASTWriter::getRawSourceLocationEncoding(), clang::VarDecl::getSourceRange(), clang::TypeDecl::getSourceRange(), clang::TagDecl::getSourceRange(), clang::ObjCPropertyImplDecl::getSourceRange(), clang::ClassTemplateSpecializationDecl::getSourceRange(), clang::VarTemplateSpecializationDecl::getSourceRange(), clang::FullSourceLoc::getSpellingColumnNumber(), clang::FullSourceLoc::getSpellingLineNumber(), clang::FullSourceLoc::getSpellingLoc(), clang::ento::PathDiagnosticLocation::getValidSourceLocation(), clang::VAOptExpansionContext::getVAOptLoc(), handleAvailabilityAttr(), clang::LogDiagnosticPrinter::HandleDiagnostic(), clang::VerifyDiagnosticConsumer::HandleDiagnostic(), clang::TextDiagnosticPrinter::HandleDiagnostic(), clang::Preprocessor::HandleEndOfFile(), handleObjCOwnershipTypeAttr(), clang::ExportDecl::hasBraces(), clang::LinkageSpecDecl::hasBraces(), clang::MSAsmStmt::hasBraces(), clang::Declarator::hasEllipsis(), clang::ObjCTypeParamDecl::hasExplicitBound(), clang::DeclRefExpr::hasExplicitTemplateArgs(), clang::MemberExpr::hasExplicitTemplateArgs(), clang::OverloadExpr::hasExplicitTemplateArgs(), clang::DependentScopeDeclRefExpr::hasExplicitTemplateArgs(), clang::CXXDependentScopeMemberExpr::hasExplicitTemplateArgs(), clang::DeclaratorChunk::FunctionTypeInfo::hasMutableQualifier(), clang::concepts::ExprRequirement::hasNoexceptRequirement(), clang::sema::LambdaScopeInfo::hasPotentialCaptures(), clang::sema::LambdaScopeInfo::hasPotentialThisCapture(), clang::DeclaratorChunk::FunctionTypeInfo::hasRefQualifier(), clang::DeclRefExpr::hasTemplateKeyword(), clang::MemberExpr::hasTemplateKeyword(), clang::OverloadExpr::hasTemplateKeyword(), clang::DependentScopeDeclRefExpr::hasTemplateKeyword(), clang::CXXDependentScopeMemberExpr::hasTemplateKeyword(), clang::ento::PathDiagnosticLocation::hasValidLocation(), clang::CodeGen::CodeGenModule::imbueXRayAttrs(), clang::syntax::TokenBuffer::indexExpandedTokens(), clang::TokenLexer::Init(), clang::ASTTemplateKWAndArgsInfo::initializeFrom(), clang::BackendConsumer::InlineAsmDiagHandler(), InventTemplateParameter(), clang::SourceManager::isAtEndOfImmediateMacroExpansion(), clang::Lexer::isAtEndOfMacroExpansion(), clang::SourceManager::isAtStartOfImmediateMacroExpansion(), clang::Lexer::isAtStartOfMacroExpansion(), clang::SourceManager::isBeforeInTranslationUnit(), clang::FullSourceLoc::isBeforeInTranslationUnitThan(), clang::AnalysisDeclContext::isBodyAutosynthesizedFromModelFile(), clang::InitListExpr::isExplicit(), clang::ParmVarDecl::isExplicitObjectParameter(), clang::Declarator::isFirstDeclarator(), clang::DeclSpec::isFriendSpecified(), clang::CodeGen::CodeGenModule::isFunctionBlockedByProfileList(), clang::SrcMgr::ExpansionInfo::isFunctionMacroExpansion(), clang::ento::AnalysisManager::isInCodeFile(), clang::Sema::isIncompatibleTypedef(), isInMainFile(), clang::CodeGen::CodeGenModule::isInNoSanitizeList(), clang::FullSourceLoc::isInSystemHeader(), clang::ObjCPropertyImplDecl::isIvarNameSpecified(), clang::SrcMgr::ExpansionInfo::isMacroArgExpansion(), clang::FullSourceLoc::isMacroArgExpansion(), clang::SrcMgr::ExpansionInfo::isMacroBodyExpansion(), clang::DeclSpec::isModulePrivateSpecified(), clang::diff::isNodeExcluded(), isNonDriverDiag(), clang::CXXBaseSpecifier::isPackExpansion(), clang::CXXCtorInitializer::isPackExpansion(), clang::UnresolvedUsingValueDecl::isPackExpansion(), clang::UnresolvedUsingTypenameDecl::isPackExpansion(), clang::FriendDecl::isPackExpansion(), clang::ObjCDictionaryElement::isPackExpansion(), clang::LambdaCapture::isPackExpansion(), clang::ParsedAttr::isPackExpansion(), isPairOfFileLocations(), isSameWidthConstantConversion(), clang::DecompositionDeclarator::isSet(), isStandardNew(), clang::MacroDirective::DefInfo::isUndefined(), clang::SourceRange::isValid(), clang::UnqualifiedId::isValid(), clang::VisibleModuleSet::isVisible(), clang::TokenLexer::Lex(), clang::CompilerInstance::loadModule(), loadModuleMapForModuleBuild(), LookupMemberExprInRecord(), clang::Sema::LookupOrCreateLabel(), clang::SourceMgrAdapter::mapLocation(), MatchTemplateParameterKind(), clang::Sema::MatchTemplateParametersToScopeSpecifier(), clang::Sema::MergeTypedefNameDecl(), noteLocation(), clang::Sema::notePreviousDefinition(), clang::Sema::NoteTemplateLocation(), clang::OverloadExpr::OverloadExpr(), clang::Parser::ParseTopLevelDecl(), clang::Parser::ParseUnqualifiedId(), populateExecutedLinesWithFunctionSignature(), clang::PrettyStackTraceDecl::print(), clang::PrettyDeclStackTraceEntry::print(), clang::PrettyStackTraceLoc::print(), print(), clang::printSourceLocationAsJson(), clang::ASTReader::ReadComments(), clang::TreeTransform< Derived >::RebuildArraySectionExpr(), clang::TreeTransform< Derived >::RebuildDependentScopeDeclRefExpr(), RedeclarePropertyAccessor(), retrieveMacroLocation(), clang::arcmt::trans::MigrationContext::rewritePropertyAttribute(), rewriteToNSEnumDecl(), SelectPropertyForSynthesisFromProtocols(), clang::comments::BlockCommandComment::setArgs(), clang::comments::HTMLStartTagComment::setAttrs(), clang::comments::BlockCommandComment::setParagraph(), clang::LinkageSpecDecl::setRBraceLoc(), clang::VirtSpecifiers::SetSpecifier(), clang::VarDecl::setTemplateSpecializationKind(), clang::FunctionDecl::setTemplateSpecializationKind(), clang::EnumDecl::setTemplateSpecializationKind(), clang::VisibleModuleSet::setVisible(), clang::XRayFunctionFilter::shouldImbueLocation(), clang::BackendConsumer::SrcMgrDiagHandler(), clang::StoredDiagnostic::StoredDiagnostic(), SuggestParentheses(), clang::takeAndConcatenateAttrs(), clang::Declarator::takeAttributes(), clang::TreeTransform< Derived >::TemporaryBase::TemporaryBase(), clang::syntax::Token::Token(), translateTemplateArgument(), clang::UndefMacroDirective::UndefMacroDirective(), clang::Sema::UnifySection(), clang::Sema::UsualUnaryConversions(), clang::ento::ConditionBRVisitor::VisitTrueTest(), warnInvalidLock(), and WarnUndefinedMethod().