aboutsummaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-01-07 01:20:12 +0000
committerTed Kremenek <kremenek@apple.com>2010-01-07 01:20:12 +0000
commit782f2f52b78d8ca785110398a7f7b56b830b9ac7 (patch)
treece9dc1c3a8a291e32b4db7e12ecb20c5e3fbdbc4 /include/clang
parent9096a20fc0fd799911b738ce7a9134dbacaf64b7 (diff)
Change ObjCContainerDecl to contain the entire range for the '@end'
piece of the declaration. The '@' and the 'end' are separate tokens, and require two SourceLocations to accurately track. This change was motivated because ObjCContainerDecl::getSourceRange() would previously not return the entire range of the declaration (the 'end' would be left off). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92891 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/AST/DeclObjC.h14
-rw-r--r--include/clang/Basic/SourceLocation.h1
-rw-r--r--include/clang/Parse/Action.h2
-rw-r--r--include/clang/Parse/Parser.h2
4 files changed, 13 insertions, 6 deletions
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index ba17eb1c1d..920d31fc7c 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -289,7 +289,9 @@ struct ObjCMethodList {
/// ObjCProtocolDecl, and ObjCImplDecl.
///
class ObjCContainerDecl : public NamedDecl, public DeclContext {
- SourceLocation AtEndLoc; // marks the end of the method container.
+ // These two locations in the range mark the end of the method container.
+ // The first points to the '@' token, and the second to the 'end' token.
+ SourceRange AtEnd;
public:
ObjCContainerDecl(Kind DK, DeclContext *DC, SourceLocation L,
@@ -351,11 +353,15 @@ public:
IdentifierInfo *PropertyId) const;
// Marks the end of the container.
- SourceLocation getAtEndLoc() const { return AtEndLoc; }
- void setAtEndLoc(SourceLocation L) { AtEndLoc = L; }
+ SourceRange getAtEndRange() const {
+ return AtEnd;
+ }
+ void setAtEndRange(SourceRange atEnd) {
+ AtEnd = atEnd;
+ }
virtual SourceRange getSourceRange() const {
- return SourceRange(getLocation(), getAtEndLoc());
+ return SourceRange(getLocation(), getAtEndRange().getEnd());
}
// Implement isa/cast/dyncast/etc.
diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h
index 36baf5feec..d4f557b57d 100644
--- a/include/clang/Basic/SourceLocation.h
+++ b/include/clang/Basic/SourceLocation.h
@@ -162,6 +162,7 @@ public:
void setEnd(SourceLocation e) { E = e; }
bool isValid() const { return B.isValid() && E.isValid(); }
+ bool isInvalid() const { return !isValid(); }
bool operator==(const SourceRange &X) const {
return B == X.B && E == X.E;
diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h
index 591ec47a68..1bf999094b 100644
--- a/include/clang/Parse/Action.h
+++ b/include/clang/Parse/Action.h
@@ -2177,7 +2177,7 @@ public:
// protocols, categories), the parser passes all methods/properties.
// For class implementations, these values default to 0. For implementations,
// methods are processed incrementally (by ActOnMethodDeclaration above).
- virtual void ActOnAtEnd(SourceLocation AtEndLoc,
+ virtual void ActOnAtEnd(SourceRange AtEnd,
DeclPtrTy classDecl,
DeclPtrTy *allMethods = 0,
unsigned allNum = 0,
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index 2214797b8f..8d651361f3 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -784,7 +784,7 @@ private:
llvm::SmallVector<DeclPtrTy, 4> PendingObjCImpDecl;
DeclPtrTy ParseObjCAtImplementationDeclaration(SourceLocation atLoc);
- DeclPtrTy ParseObjCAtEndDeclaration(SourceLocation atLoc);
+ DeclPtrTy ParseObjCAtEndDeclaration(SourceRange atEnd);
DeclPtrTy ParseObjCAtAliasDeclaration(SourceLocation atLoc);
DeclPtrTy ParseObjCPropertySynthesize(SourceLocation atLoc);
DeclPtrTy ParseObjCPropertyDynamic(SourceLocation atLoc);