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().

llvm-svn: 44950
This commit is contained in:
Ted Kremenek 2007-12-12 18:54:21 +00:00
parent 50d23f007f
commit febe89a6da
1 changed files with 8 additions and 16 deletions

View File

@ -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;
}