]> granicus.if.org Git - clang/commitdiff
Changes to FullSourceLoc:
authorTed Kremenek <kremenek@apple.com>
Wed, 12 Dec 2007 18:54:21 +0000 (18:54 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 12 Dec 2007 18:54:21 +0000 (18:54 +0000)
  - 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

include/clang/Basic/SourceLocation.h

index c46458c36684cbb979133bbb5cefeddb497af220..60bba98abfb14cc256ec98d07e6e34cbba0ca9d2 100644 (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;
   }