[cfe-commits] r44950 - /cfe/trunk/include/clang/Basic/SourceLocation.h

Ted Kremenek kremenek at apple.com
Wed Dec 12 10:54:23 PST 2007


Author: kremenek
Date: Wed Dec 12 12:54:21 2007
New Revision: 44950

URL: http://llvm.org/viewvc/llvm-project?rev=44950&view=rev
Log:
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().

Modified:
    cfe/trunk/include/clang/Basic/SourceLocation.h

Modified: cfe/trunk/include/clang/Basic/SourceLocation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceLocation.h?rev=44950&r1=44949&r2=44950&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/SourceLocation.h (original)
+++ cfe/trunk/include/clang/Basic/SourceLocation.h Wed Dec 12 12:54:21 2007
@@ -206,29 +206,21 @@
 ///  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;
   }





More information about the cfe-commits mailing list