aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-10-16 22:36:42 +0000
committerChris Lattner <sabre@nondot.org>2007-10-16 22:36:42 +0000
commit311ff02fae0392bee6abe7723cdf5a69b2899a47 (patch)
treed5ad955ebc02cca2d55aec58847593b73ffa340a /include
parent3e7fd152aa8f13da75cd91a96ef78cc823c5f32d (diff)
Add a new Rewriter::getRangeSize method.
Rename SourceRange::Begin()/End() to getBegin()/getEnd() for consistency with other code. Start building the rewriter towards handling @encode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43047 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/AST/Expr.h2
-rw-r--r--include/clang/AST/ExprCXX.h2
-rw-r--r--include/clang/AST/Stmt.h4
-rw-r--r--include/clang/Basic/SourceLocation.h4
-rw-r--r--include/clang/Rewrite/Rewriter.h8
5 files changed, 12 insertions, 8 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index 9a9e7c6057..10273529cd 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -703,7 +703,7 @@ public:
Expr *getSubExpr() const { return Op; }
virtual SourceRange getSourceRange() const {
- return SourceRange(Loc, getSubExpr()->getSourceRange().End());
+ return SourceRange(Loc, getSubExpr()->getSourceRange().getEnd());
}
static bool classof(const Stmt *T) {
return T->getStmtClass() == CastExprClass;
diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h
index 14b1cc7d3a..fadfa1c148 100644
--- a/include/clang/AST/ExprCXX.h
+++ b/include/clang/AST/ExprCXX.h
@@ -60,7 +60,7 @@ namespace clang {
}
virtual SourceRange getSourceRange() const {
- return SourceRange(Loc, getSubExpr()->getSourceRange().End());
+ return SourceRange(Loc, getSubExpr()->getSourceRange().getEnd());
}
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXCastExprClass;
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index 2f3544e6e4..0aadb079a4 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -55,8 +55,8 @@ public:
/// value objects created/interpreted by SourceManager. We assume AST
/// clients will have a pointer to the respective SourceManager.
virtual SourceRange getSourceRange() const = 0;
- SourceLocation getLocStart() const { return getSourceRange().Begin(); }
- SourceLocation getLocEnd() const { return getSourceRange().End(); }
+ SourceLocation getLocStart() const { return getSourceRange().getBegin(); }
+ SourceLocation getLocEnd() const { return getSourceRange().getEnd(); }
// global temp stats (until we have a per-module visitor)
static void addStmtClass(const StmtClass s);
diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h
index 1ebb0ff3f8..f5cad5cea4 100644
--- a/include/clang/Basic/SourceLocation.h
+++ b/include/clang/Basic/SourceLocation.h
@@ -166,8 +166,8 @@ public:
SourceRange(SourceLocation loc) : B(loc), E(loc) {}
SourceRange(SourceLocation begin, SourceLocation end) : B(begin), E(end) {}
- SourceLocation Begin() const { return B; }
- SourceLocation End() const { return E; }
+ SourceLocation getBegin() const { return B; }
+ SourceLocation getEnd() const { return E; }
void setBegin(SourceLocation b) { B = b; }
void setEnd(SourceLocation e) { E = e; }
diff --git a/include/clang/Rewrite/Rewriter.h b/include/clang/Rewrite/Rewriter.h
index 6e8c2084c6..bf4baf25af 100644
--- a/include/clang/Rewrite/Rewriter.h
+++ b/include/clang/Rewrite/Rewriter.h
@@ -121,6 +121,10 @@ public:
static bool isRewritable(SourceLocation Loc) {
return Loc.isFileID();
}
+
+ /// getRangeSize - Return the size in bytes of the specified range if they
+ /// are in the same file. If not, this returns -1.
+ int getRangeSize(SourceRange Range) const;
/// InsertText - Insert the specified string at the specified location in the
/// original buffer. This method is only valid on rewritable source
@@ -128,8 +132,8 @@ public:
void InsertText(SourceLocation Loc, const char *StrData, unsigned StrLen);
/// RemoveText - Remove the specified text region. This method is only valid
- /// on rewritable source locations.
- void RemoveText(SourceLocation Start, SourceLocation End);
+ /// on a rewritable source location.
+ void RemoveText(SourceLocation Start, unsigned Length);
/// ReplaceText - This method replaces a range of characters in the input
/// buffer with a new string. This is effectively a combined "remove/insert"