aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/SourceLocation.h
diff options
context:
space:
mode:
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;
}