From: Ted Kremenek Date: Wed, 12 Dec 2007 18:54:21 +0000 (+0000) Subject: Changes to FullSourceLoc: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b924fd6a9730e7de1b175fb82434de6e7e0f0f8;p=clang 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 --- 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; }