aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/SourceLocation.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-12-12 18:54:21 +0000
committerTed Kremenek <kremenek@apple.com>2007-12-12 18:54:21 +0000
commit1b924fd6a9730e7de1b175fb82434de6e7e0f0f8 (patch)
tree273bc036b37629595745ddda8e4b020871de60d1 /include/clang/Basic/SourceLocation.h
parent2a2da1d0522b59c8c56f97a8607106be977a14af (diff)
Changes to FullSourceLoc:
- Added cstor that takes no arguments to create an "invalid" location. - Removed non-const version of getSourceManager(). - Renamed getSourceManager() to getManager. - Remover operator SourceLocatio(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44950 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/SourceLocation.h')
-rw-r--r--include/clang/Basic/SourceLocation.h24
1 files changed, 8 insertions, 16 deletions
diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h
index c46458c366..60bba98abf 100644
--- a/include/clang/Basic/SourceLocation.h
+++ b/include/clang/Basic/SourceLocation.h
@@ -206,29 +206,21 @@ public:
/// that expect both objects.
class FullSourceLoc {
SourceLocation Loc;
- SourceManager* SrcMgr;
+ const SourceManager* SrcMgr;
public:
- explicit FullSourceLoc(SourceLocation loc)
- : Loc(loc), SrcMgr(NULL) {}
+ // Creates a FullSourceLoc where isValid() returns false.
+ explicit FullSourceLoc() : Loc(SourceLocation()), SrcMgr(NULL) {}
- explicit FullSourceLoc(SourceLocation loc, SourceManager& smgr)
- : Loc(loc), SrcMgr(&smgr) {}
-
- static FullSourceLoc CreateInvalidLocation() {
- return FullSourceLoc(SourceLocation());
+ explicit FullSourceLoc(SourceLocation loc, const SourceManager& smgr)
+ : Loc(loc), SrcMgr(&smgr) {
+ assert (loc.isValid() && "SourceLocation must be valid!");
}
-
+
bool isValid() const { return Loc.isValid(); }
SourceLocation getSourceLocation() const { return Loc; }
- operator SourceLocation() const { return Loc; }
-
- SourceManager& getSourceManager() {
- assert (SrcMgr && "SourceManager is NULL.");
- return *SrcMgr;
- }
- const SourceManager& getSourceManager() const {
+ const SourceManager& getManager() const {
assert (SrcMgr && "SourceManager is NULL.");
return *SrcMgr;
}