aboutsummaryrefslogtreecommitdiff
path: root/lib/Index/ASTLocation.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-06 21:35:20 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-06 21:35:20 +0000
commit755c6b42154e7c2225d973babf84eb2587576bcd (patch)
tree1f2e952ec68f69f37524d09c12439ab08e37e52b /lib/Index/ASTLocation.cpp
parent8fb3333d45ab3b327766e26310581cacf43fb374 (diff)
Some changes to ASTLocation's methods
-Change hasStmt() to isStmt() -Add isDecl() -Add getSourceRange() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74862 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Index/ASTLocation.cpp')
-rw-r--r--lib/Index/ASTLocation.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Index/ASTLocation.cpp b/lib/Index/ASTLocation.cpp
index 4b95d9d554..3cd657b9b9 100644
--- a/lib/Index/ASTLocation.cpp
+++ b/lib/Index/ASTLocation.cpp
@@ -66,6 +66,10 @@ bool ASTLocation::isImmediateParent(Decl *D, Stmt *Node) {
return D == FindImmediateParent(D, Node);
}
+SourceRange ASTLocation::getSourceRange() const {
+ return isDecl() ? getDecl()->getSourceRange() : getStmt()->getSourceRange();
+}
+
void ASTLocation::print(llvm::raw_ostream &OS) {
assert(isValid() && "ASTLocation is not valid");
@@ -81,8 +85,7 @@ void ASTLocation::print(llvm::raw_ostream &OS) {
OS << "] <";
- SourceRange Range = hasStmt() ? getStmt()->getSourceRange()
- : getDecl()->getSourceRange();
+ SourceRange Range = getSourceRange();
SourceManager &SourceMgr = getDecl()->getASTContext().getSourceManager();
Range.getBegin().print(OS, SourceMgr);
OS << ", ";