Skip to content

Commit

Permalink
Port getLocStart -> getBeginLoc
Browse files Browse the repository at this point in the history
Reviewers: teemperor!

Subscribers: jholewinski, whisperity, jfb, cfe-commits

Differential Revision: https://reviews.llvm.org/D50350

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339385 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
steveire committed Aug 9, 2018
1 parent a7d2786 commit d7b659b
Show file tree
Hide file tree
Showing 147 changed files with 2,369 additions and 2,553 deletions.
4 changes: 2 additions & 2 deletions docs/RAVFrontendAction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ locations:
if (Declaration->getQualifiedNameAsString() == "n::m::C") {
// getFullLoc uses the ASTContext's SourceManager to resolve the source
// location and break it up into its line and column parts.
FullSourceLoc FullLocation = Context->getFullLoc(Declaration->getLocStart());
FullSourceLoc FullLocation = Context->getFullLoc(Declaration->getBeginLoc());
if (FullLocation.isValid())
llvm::outs() << "Found declaration at "
<< FullLocation.getSpellingLineNumber() << ":"
Expand Down Expand Up @@ -160,7 +160,7 @@ Now we can combine all of the above into a small example program:

bool VisitCXXRecordDecl(CXXRecordDecl *Declaration) {
if (Declaration->getQualifiedNameAsString() == "n::m::C") {
FullSourceLoc FullLocation = Context->getFullLoc(Declaration->getLocStart());
FullSourceLoc FullLocation = Context->getFullLoc(Declaration->getBeginLoc());
if (FullLocation.isValid())
llvm::outs() << "Found declaration at "
<< FullLocation.getSpellingLineNumber() << ":"
Expand Down
21 changes: 10 additions & 11 deletions include/clang/AST/Comment.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ class InlineCommandComment : public InlineContentComment {
}

SourceRange getCommandNameRange() const {
return SourceRange(getLocStart().getLocWithOffset(-1),
getLocEnd());
return SourceRange(getBeginLoc().getLocWithOffset(-1), getLocEnd());
}

RenderKind getRenderKind() const {
Expand Down Expand Up @@ -564,9 +563,9 @@ class ParagraphComment : public BlockContentComment {

ParagraphCommentBits.IsWhitespaceValid = false;

setSourceRange(SourceRange(Content.front()->getLocStart(),
setSourceRange(SourceRange(Content.front()->getBeginLoc(),
Content.back()->getLocEnd()));
setLocation(Content.front()->getLocStart());
setLocation(Content.front()->getBeginLoc());
}

static bool classof(const Comment *C) {
Expand Down Expand Up @@ -660,13 +659,13 @@ class BlockCommandComment : public BlockContentComment {
}

SourceLocation getCommandNameBeginLoc() const {
return getLocStart().getLocWithOffset(1);
return getBeginLoc().getLocWithOffset(1);
}

SourceRange getCommandNameRange(const CommandTraits &Traits) const {
StringRef Name = getCommandName(Traits);
return SourceRange(getCommandNameBeginLoc(),
getLocStart().getLocWithOffset(1 + Name.size()));
getBeginLoc().getLocWithOffset(1 + Name.size()));
}

unsigned getNumArgs() const {
Expand All @@ -686,7 +685,7 @@ class BlockCommandComment : public BlockContentComment {
if (Args.size() > 0) {
SourceLocation NewLocEnd = Args.back().Range.getEnd();
if (NewLocEnd.isValid())
setSourceRange(SourceRange(getLocStart(), NewLocEnd));
setSourceRange(SourceRange(getBeginLoc(), NewLocEnd));
}
}

Expand All @@ -702,7 +701,7 @@ class BlockCommandComment : public BlockContentComment {
Paragraph = PC;
SourceLocation NewLocEnd = PC->getLocEnd();
if (NewLocEnd.isValid())
setSourceRange(SourceRange(getLocStart(), NewLocEnd));
setSourceRange(SourceRange(getBeginLoc(), NewLocEnd));
}

CommandMarkerKind getCommandMarker() const LLVM_READONLY {
Expand Down Expand Up @@ -1103,9 +1102,9 @@ class FullComment : public Comment {
if (Blocks.empty())
return;

setSourceRange(SourceRange(Blocks.front()->getLocStart(),
Blocks.back()->getLocEnd()));
setLocation(Blocks.front()->getLocStart());
setSourceRange(
SourceRange(Blocks.front()->getBeginLoc(), Blocks.back()->getLocEnd()));
setLocation(Blocks.front()->getBeginLoc());
}

static bool classof(const Comment *C) {
Expand Down
2 changes: 1 addition & 1 deletion include/clang/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3117,7 +3117,7 @@ class TagDecl : public TypeDecl,

/// Return SourceLocation representing start of source
/// range ignoring outer template declarations.
SourceLocation getInnerLocStart() const { return getLocStart(); }
SourceLocation getInnerLocStart() const { return getBeginLoc(); }

/// Return SourceLocation representing start of source
/// range taking into account any outer template declarations.
Expand Down
4 changes: 2 additions & 2 deletions include/clang/AST/DeclCXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class CXXBaseSpecifier {

/// Get the location at which the base class type was written.
SourceLocation getBaseTypeLoc() const LLVM_READONLY {
return BaseTypeInfo->getTypeLoc().getLocStart();
return BaseTypeInfo->getTypeLoc().getBeginLoc();
}

/// Determines whether the base class is a virtual base class (or not).
Expand Down Expand Up @@ -3687,7 +3687,7 @@ class UnresolvedUsingTypenameDecl

public:
/// Returns the source location of the 'using' keyword.
SourceLocation getUsingLoc() const { return getLocStart(); }
SourceLocation getUsingLoc() const { return getBeginLoc(); }

/// Returns the source location of the 'typename' keyword.
SourceLocation getTypenameLoc() const { return TypenameLocation; }
Expand Down
2 changes: 1 addition & 1 deletion include/clang/AST/DeclObjC.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext {

SourceLocation getSelectorStartLoc() const {
if (isImplicit())
return getLocStart();
return getBeginLoc();
return getSelectorLoc(0);
}

Expand Down
4 changes: 2 additions & 2 deletions include/clang/AST/DeclarationName.h
Original file line number Diff line number Diff line change
Expand Up @@ -639,15 +639,15 @@ struct DeclarationNameInfo {

/// getSourceRange - The range of the declaration name.
SourceRange getSourceRange() const LLVM_READONLY {
return SourceRange(getLocStart(), getLocEnd());
return SourceRange(getBeginLoc(), getLocEnd());
}

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }

SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
SourceLocation EndLoc = getEndLocPrivate();
return EndLoc.isValid() ? EndLoc : getLocStart();
return EndLoc.isValid() ? EndLoc : getBeginLoc();
}

private:
Expand Down
26 changes: 13 additions & 13 deletions include/clang/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ class OpaqueValueExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return SourceExpr ? SourceExpr->getLocStart() : Loc;
return SourceExpr ? SourceExpr->getBeginLoc() : Loc;
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
Expand Down Expand Up @@ -1550,7 +1550,7 @@ class ImaginaryLiteral : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return Val->getLocStart();
return Val->getBeginLoc();
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY { return Val->getLocEnd(); }
Expand Down Expand Up @@ -1896,7 +1896,7 @@ class UnaryOperator : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return isPostfix() ? Val->getLocStart() : Loc;
return isPostfix() ? Val->getBeginLoc() : Loc;
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
Expand Down Expand Up @@ -2282,7 +2282,7 @@ class ArraySubscriptExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getLHS()->getLocStart();
return getLHS()->getBeginLoc();
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY { return RBracketLoc; }
Expand Down Expand Up @@ -2798,7 +2798,7 @@ class CompoundLiteralExpr : public Expr {
if (!Init)
return SourceLocation();
if (LParenLoc.isInvalid())
return Init->getLocStart();
return Init->getBeginLoc();
return LParenLoc;
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
Expand Down Expand Up @@ -2998,7 +2998,7 @@ class ImplicitCastExpr final

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getSubExpr()->getLocStart();
return getSubExpr()->getBeginLoc();
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
Expand Down Expand Up @@ -3191,7 +3191,7 @@ class BinaryOperator : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getLHS()->getLocStart();
return getLHS()->getBeginLoc();
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
Expand Down Expand Up @@ -3476,7 +3476,7 @@ class ConditionalOperator : public AbstractConditionalOperator {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getCond()->getLocStart();
return getCond()->getBeginLoc();
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
Expand Down Expand Up @@ -3566,7 +3566,7 @@ class BinaryConditionalOperator : public AbstractConditionalOperator {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getCommon()->getLocStart();
return getCommon()->getBeginLoc();
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
Expand Down Expand Up @@ -4471,7 +4471,7 @@ class DesignatedInitExpr final
return Kind == FieldDesignator ? getFieldLoc() : getRBracketLoc();
}
SourceRange getSourceRange() const LLVM_READONLY {
return SourceRange(getLocStart(), getLocEnd());
return SourceRange(getBeginLoc(), getLocEnd());
}
};

Expand Down Expand Up @@ -4710,7 +4710,7 @@ class ArrayInitLoopExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getCommonExpr()->getLocStart();
return getCommonExpr()->getBeginLoc();
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
Expand Down Expand Up @@ -5026,7 +5026,7 @@ class ExtVectorElementExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getBase()->getLocStart();
return getBase()->getBeginLoc();
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY { return AccessorLoc; }
Expand Down Expand Up @@ -5276,7 +5276,7 @@ class PseudoObjectExpr final

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getSyntacticForm()->getLocStart();
return getSyntacticForm()->getBeginLoc();
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
Expand Down
Loading

0 comments on commit d7b659b

Please sign in to comment.