Skip to content

Conversation

@rintaro
Copy link
Member

@rintaro rintaro commented Mar 20, 2017

Reorganize SourceManager methods regarding filename, line and column.
https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20170313/004232.html
The first commit is strictly NFC.

Presumed locations ( respects #sourceLocation directive)
getBufferIdentifierForLoc(Loc)getPresumedFilenameForLoc(Loc)
getLineAndColumn(Loc)getPresumedLineAndColumnForLoc(Loc)

Physical locations (ignores #sourceLocation directive)
getIdentifierForBuffer(BufferID) → ASIS
new getIdentifierForBuffer(Loc)
getLineNumber(Loc)getLineAndColumnInBuffer(Loc).first
resolveFromLineCol(BufferID, Line, Column)getOffsetForLineAndColumnInBuffer(BufferID, Line, Column)
getLocForLineCol(BufferID, Line, Column)getLocForLineAndColumnInBuffer(BufferID, Line, Column)


Audit checklist

  • AST
    • ASTScope::print
    • ConformanceLookupTable::compareProtocolConformances
    • DeclContext::printContext
    • GenericSignatureBuilder::RequirementSource::print
    • SingleRawComment::SingleRawComment → Use physical line and column, modified
  • Basic
    • SourceLoc::printLineAndColumn
    • swift::writeEditsInJson → Use physical filename, asis
  • Frontend
    • DiagnosticVerifier::verifyFile
    • SourceManager::GetMessage → Use presumed filename, line and column, asis.
  • IDE
    • SerializedDiagnosticConsumer::addLocToRecord
    • CommentToXMLConverter::visitDocComment
    • swift::ide::getLocationInfo
    • swift::ide::reformat (lib/IDE/Formatting.cpp)
  • IRGen
    • PrettySourceFileEmission::print
    • IRGenDebugInfo::IRGenDebugInfo
  • Index
    • index::indexSourceFile
  • Parse
    • Lexer::getLocForStartOfToken → Unused function, removed
    • Parser::parseLineDirective → Use physical line, asis
    • Parser::parseTrailingClosure → Use physical line, asis
    • Parser::parseStmtReturn → Use physical column, modified
  • SIL
    • SILLocation::decode
  • SILGen
    • SILGenFunction::emitLiteral (#file value) Use presumed filename, asis
    • SILGenFunction::emitPreconditionOptionalHasValue Use presumed filename and line, modified
    • RValueEmitter::visitMagicIdentifierLiteralExpr (#line and #column value) Use presumed line and column, asis
    • CoverageMapping::emitSourceRegions
  • Sema
    • NameBinder::addImport
    • FailureDiagnosis::visitApplyExpr → Use physical line, asis
    • swift::performStmtDiagnostics → Use physical line and column, modified
    • swift::performPCMacro
    • swift::performPlaygroundTransform
    • static diagnoseAndMigrateVarParameterToBody → Use physical line, asis
  • Serialization
    • GroupNameCollectorFromJson::getGroupNameInternal
  • SourceKit
    • EditorDiagConsumer::handleDiagnostic
    • SwiftEditorSyntaxWalker::walkToNodePre
    • SwiftEditorDocument::replaceText
  • swift-ide-test
    • AnnotationPrinter::printLoc
    • ASTTypePrinter::walkToExprPre
    • ASTCommentPrinter::walkToDeclPre
    • USRPrinter::printLoc

Distinguish source location realted method names between
'#sourceLocation'-respecting and not.
@rintaro rintaro force-pushed the srcmanager-linecolumn branch from ee0327f to 5a22e2f Compare March 21, 2017 07:09
rintaro added 5 commits March 21, 2017 19:00
Lexer::getLocForStartOfToken(SourceManager, SourceLoc)
NFC, becuase we can't devide single comment with #sourceLocation
directive.
NFC, because we can't divide single switch case with #sourceLocation
directive.
@CodaFi
Copy link
Contributor

CodaFi commented Nov 14, 2019

@rintaro Can we still take this?

@rintaro
Copy link
Member Author

rintaro commented May 21, 2020

@owenv is taking over this effort in #31943 . Closing.

@rintaro rintaro closed this May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants