Rename 'ASTNode' -> 'ASTLocation'.

ASTLocation is a much better name for its intended purpose which to represent a "point" into the AST.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74858 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/ASTNode.h b/include/clang/AST/ASTLocation.h
similarity index 74%
rename from include/clang/AST/ASTNode.h
rename to include/clang/AST/ASTLocation.h
index 852e946..f6ace25 100644
--- a/include/clang/AST/ASTNode.h
+++ b/include/clang/AST/ASTLocation.h
@@ -1,4 +1,4 @@
-//===--- ASTNode.h - A <Decl, Stmt> pair ------------------------*- C++ -*-===//
+//===--- ASTLocation.h - A <Decl, Stmt> pair --------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,12 +7,12 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  ASTNode is Decl or a Stmt and its immediate Decl parent.
+//  ASTLocation is Decl or a Stmt and its immediate Decl parent.
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_AST_ASTNODE_H
-#define LLVM_CLANG_AST_ASTNODE_H
+#ifndef LLVM_CLANG_AST_ASTLOCATION_H
+#define LLVM_CLANG_AST_ASTLOCATION_H
 
 #include <cassert>
 
@@ -26,14 +26,14 @@
 
 /// \brief Represents a Decl or a Stmt and its immediate Decl parent. It's
 /// immutable.
-class ASTNode {
+class ASTLocation {
   Decl *D;
   Stmt *Stm;
 
 public:
-  ASTNode() : D(0), Stm(0) {}
+  ASTLocation() : D(0), Stm(0) {}
 
-  explicit ASTNode(const Decl *d, const Stmt *stm = 0)
+  explicit ASTLocation(const Decl *d, const Stmt *stm = 0)
     : D(const_cast<Decl*>(d)), Stm(const_cast<Stmt*>(stm)) {
     assert((Stm == 0 || isImmediateParent(D, Stm)) &&
            "The Decl is not the immediate parent of the Stmt.");
@@ -51,10 +51,10 @@
   /// \brief Checks that D is the immediate Decl parent of Node.
   static bool isImmediateParent(Decl *D, Stmt *Node);
 
-  friend bool operator==(const ASTNode &L, const ASTNode &R) { 
+  friend bool operator==(const ASTLocation &L, const ASTLocation &R) { 
     return L.D == R.D && L.Stm == R.Stm;
   }
-  friend bool operator!=(const ASTNode &L, const ASTNode &R) { 
+  friend bool operator!=(const ASTLocation &L, const ASTLocation &R) { 
     return !(L == R);
   }
   
diff --git a/include/clang/AST/DeclReferenceMap.h b/include/clang/AST/DeclReferenceMap.h
index b2068fb..9dd5d47 100644
--- a/include/clang/AST/DeclReferenceMap.h
+++ b/include/clang/AST/DeclReferenceMap.h
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  DeclReferenceMap creates a mapping from Decls to the ASTNodes that
+//  DeclReferenceMap creates a mapping from Decls to the ASTLocations that
 //  reference them.
 //
 //===----------------------------------------------------------------------===//
@@ -15,14 +15,14 @@
 #ifndef LLVM_CLANG_AST_DECLREFERENCEMAP_H
 #define LLVM_CLANG_AST_DECLREFERENCEMAP_H
 
-#include "clang/AST/ASTNode.h"
+#include "clang/AST/ASTLocation.h"
 #include <map>
 
 namespace clang {
   class ASTContext;
   class NamedDecl;
   
-/// \brief Maps NamedDecls with the ASTNodes that reference them.
+/// \brief Maps NamedDecls with the ASTLocations that reference them.
 ///
 /// References are mapped and retrieved using the primary decls
 /// (see Decl::getPrimaryDecl()).
@@ -30,47 +30,47 @@
 public:
   explicit DeclReferenceMap(ASTContext &Ctx);
   
-  typedef std::multimap<NamedDecl*, ASTNode> MapTy;
+  typedef std::multimap<NamedDecl*, ASTLocation> MapTy;
 
-  class astnode_iterator {
+  class astlocation_iterator {
     MapTy::iterator I;
 
-    astnode_iterator(MapTy::iterator i) : I(i) { }
+    astlocation_iterator(MapTy::iterator i) : I(i) { }
     friend class DeclReferenceMap;
 
   public:
-    typedef ASTNode  value_type;
-    typedef ASTNode& reference;
-    typedef ASTNode* pointer;
+    typedef ASTLocation  value_type;
+    typedef ASTLocation& reference;
+    typedef ASTLocation* pointer;
     typedef MapTy::iterator::iterator_category iterator_category;
     typedef MapTy::iterator::difference_type   difference_type;
 
-    astnode_iterator() { }
+    astlocation_iterator() { }
 
     reference operator*() const { return I->second; }
     pointer operator->() const { return &I->second; }
 
-    astnode_iterator& operator++() {
+    astlocation_iterator& operator++() {
       ++I;
       return *this;
     }
 
-    astnode_iterator operator++(int) {
-      astnode_iterator tmp(*this);
+    astlocation_iterator operator++(int) {
+      astlocation_iterator tmp(*this);
       ++(*this);
       return tmp;
     }
 
-    friend bool operator==(astnode_iterator L, astnode_iterator R) { 
+    friend bool operator==(astlocation_iterator L, astlocation_iterator R) { 
       return L.I == R.I;
     }
-    friend bool operator!=(astnode_iterator L, astnode_iterator R) { 
+    friend bool operator!=(astlocation_iterator L, astlocation_iterator R) { 
       return L.I != R.I;
     }
   };
 
-  astnode_iterator refs_begin(NamedDecl *D) const;
-  astnode_iterator refs_end(NamedDecl *D) const;
+  astlocation_iterator refs_begin(NamedDecl *D) const;
+  astlocation_iterator refs_end(NamedDecl *D) const;
   bool refs_empty(NamedDecl *D) const;
   
 private:
diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h
index 7e7efbc..3153e40 100644
--- a/include/clang/Frontend/Utils.h
+++ b/include/clang/Frontend/Utils.h
@@ -36,7 +36,7 @@
 class Stmt;
 class ASTContext;
 class SourceLocation;
-class ASTNode;
+class ASTLocation;
 
 /// ProcessWarningOptions - Initialize the diagnostic client and process the
 /// warning options specified on the command line.
@@ -103,7 +103,7 @@
 /// Pointing at '100' will return a <VarDecl 'foo', IntegerLiteral '100'> pair.
 /// Pointing at '++foo' will return a <FunctionDecl 'f', UnaryOperator> pair.
 ///
-ASTNode ResolveLocationInAST(ASTContext &Ctx, SourceLocation Loc);
+ASTLocation ResolveLocationInAST(ASTContext &Ctx, SourceLocation Loc);
 
 }  // end namespace clang
 
diff --git a/lib/AST/ASTNode.cpp b/lib/AST/ASTLocation.cpp
similarity index 87%
rename from lib/AST/ASTNode.cpp
rename to lib/AST/ASTLocation.cpp
index ff5ecc1..e72acf0 100644
--- a/lib/AST/ASTNode.cpp
+++ b/lib/AST/ASTLocation.cpp
@@ -1,4 +1,4 @@
-//===--- ASTNode.h - A <Decl, Stmt> pair ------------------------*- C++ -*-===//
+//===--- ASTLocation.h - A <Decl, Stmt> pair --------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,11 +7,11 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  ASTNode is Decl or a Stmt and its immediate Decl parent.
+//  ASTLocation is Decl or a Stmt and its immediate Decl parent.
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/AST/ASTNode.h"
+#include "clang/AST/ASTLocation.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/Stmt.h"
 #include "clang/AST/Expr.h"
@@ -60,13 +60,13 @@
   return 0;
 }
 
-bool ASTNode::isImmediateParent(Decl *D, Stmt *Node) {
+bool ASTLocation::isImmediateParent(Decl *D, Stmt *Node) {
   assert(D && Node && "Passed null Decl or null Stmt");
   return D == FindImmediateParent(D, Node);
 }
 
-void ASTNode::print(llvm::raw_ostream &OS) {
-  assert(isValid() && "ASTNode is not valid");
+void ASTLocation::print(llvm::raw_ostream &OS) {
+  assert(isValid() && "ASTLocation is not valid");
 
   OS << "[Decl: " << getDecl()->getDeclKindName() << " ";
   if (NamedDecl *ND = dyn_cast<NamedDecl>(getDecl()))
diff --git a/lib/AST/CMakeLists.txt b/lib/AST/CMakeLists.txt
index 899bc8f..f844cf1 100644
--- a/lib/AST/CMakeLists.txt
+++ b/lib/AST/CMakeLists.txt
@@ -4,7 +4,7 @@
   APValue.cpp
   ASTConsumer.cpp
   ASTContext.cpp
-  ASTNode.cpp
+  ASTLocation.cpp
   CFG.cpp
   DeclarationName.cpp
   DeclBase.cpp
diff --git a/lib/AST/DeclReferenceMap.cpp b/lib/AST/DeclReferenceMap.cpp
index 3e0114a..41f53fd 100644
--- a/lib/AST/DeclReferenceMap.cpp
+++ b/lib/AST/DeclReferenceMap.cpp
@@ -7,15 +7,15 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  DeclReferenceMap creates a mapping from Decls to the ASTNodes that
-//  references them.
+//  DeclReferenceMap creates a mapping from Decls to the ASTLocations that
+//  reference them.
 //
 //===----------------------------------------------------------------------===//
 
 #include "clang/AST/DeclReferenceMap.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/Stmt.h"
-#include "clang/AST/ASTNode.h"
+#include "clang/AST/ASTLocation.h"
 #include "clang/AST/DeclVisitor.h"
 #include "clang/AST/StmtVisitor.h"
 #include "llvm/Support/Compiler.h"
@@ -65,7 +65,7 @@
 
 void StmtMapper::VisitDeclRefExpr(DeclRefExpr *Node) {
   NamedDecl *PrimD = cast<NamedDecl>(Node->getDecl()->getPrimaryDecl());
-  Map.insert(std::make_pair(PrimD, ASTNode(Parent, Node)));
+  Map.insert(std::make_pair(PrimD, ASTLocation(Parent, Node)));
 }
 
 void StmtMapper::VisitStmt(Stmt *Node) {
@@ -113,16 +113,16 @@
   DeclMapper(Map).Visit(Ctx.getTranslationUnitDecl());
 }
 
-DeclReferenceMap::astnode_iterator
+DeclReferenceMap::astlocation_iterator
 DeclReferenceMap::refs_begin(NamedDecl *D) const {
   NamedDecl *Prim = cast<NamedDecl>(D->getPrimaryDecl());
-  return astnode_iterator(Map.lower_bound(Prim));  
+  return astlocation_iterator(Map.lower_bound(Prim));  
 }
 
-DeclReferenceMap::astnode_iterator
+DeclReferenceMap::astlocation_iterator
 DeclReferenceMap::refs_end(NamedDecl *D) const {
   NamedDecl *Prim = cast<NamedDecl>(D->getPrimaryDecl());
-  return astnode_iterator(Map.upper_bound(Prim));  
+  return astlocation_iterator(Map.upper_bound(Prim));  
 }
 
 bool DeclReferenceMap::refs_empty(NamedDecl *D) const {
diff --git a/lib/Frontend/ResolveLocation.cpp b/lib/Frontend/ResolveLocation.cpp
index 5b8eed0..c2d32bb 100644
--- a/lib/Frontend/ResolveLocation.cpp
+++ b/lib/Frontend/ResolveLocation.cpp
@@ -13,7 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/Frontend/Utils.h"
-#include "clang/AST/ASTNode.h"
+#include "clang/AST/ASTLocation.h"
 #include "clang/AST/DeclVisitor.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/Lex/Lexer.h"
@@ -321,11 +321,11 @@
 
 /// \brief Returns the AST node that a source location points to.
 ///
-ASTNode clang::ResolveLocationInAST(ASTContext &Ctx, SourceLocation Loc) {
+ASTLocation clang::ResolveLocationInAST(ASTContext &Ctx, SourceLocation Loc) {
   if (Loc.isInvalid())
-    return ASTNode();
+    return ASTLocation();
   
   DeclLocResolver DLR(Ctx, Loc);
   DLR.Visit(Ctx.getTranslationUnitDecl());
-  return ASTNode(DLR.getDecl(), DLR.getStmt());
+  return ASTLocation(DLR.getDecl(), DLR.getStmt());
 }
diff --git a/tools/index-test/index-test.cpp b/tools/index-test/index-test.cpp
index 5043e3e..f44cd53 100644
--- a/tools/index-test/index-test.cpp
+++ b/tools/index-test/index-test.cpp
@@ -22,13 +22,13 @@
 //       specified, prints some info about it.
 //
 //   -print-refs
-//       Print ASTNodes that reference the -point-at node
+//       Print ASTLocations that reference the -point-at node
 //
 //   -print-defs
-//       Print ASTNodes that define the -point-at node
+//       Print ASTLocations that define the -point-at node
 //
 //   -print-decls
-//       Print ASTNodes that declare the -point-at node
+//       Print ASTLocations that declare the -point-at node
 //
 //===----------------------------------------------------------------------===//
 
@@ -41,7 +41,7 @@
 #include "clang/Frontend/CommandLineSourceLoc.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/Expr.h"
-#include "clang/AST/ASTNode.h"
+#include "clang/AST/ASTLocation.h"
 #include "clang/AST/DeclReferenceMap.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceManager.h"
@@ -107,7 +107,7 @@
       return;
 
     DeclReferenceMap RefMap(ND->getASTContext());
-    for (DeclReferenceMap::astnode_iterator
+    for (DeclReferenceMap::astlocation_iterator
            I = RefMap.refs_begin(ND), E = RefMap.refs_end(ND); I != E; ++I)
       I->print(OS);
     break;
@@ -126,29 +126,29 @@
     } 
 
     if (DefD)
-      ASTNode(DefD).print(OS);
+      ASTLocation(DefD).print(OS);
     break;    
   }
   
   case PrintDecls :
     if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
       while (FD) {
-        ASTNode(FD).print(OS);
+        ASTLocation(FD).print(OS);
         FD = FD->getPreviousDeclaration();
       }
     } else if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
       while (VD) {
-        ASTNode(VD).print(OS);
+        ASTLocation(VD).print(OS);
         VD = VD->getPreviousDeclaration();
       }
     } else
-      ASTNode(D).print(OS);
+      ASTLocation(D).print(OS);
     break;
     
   }
 }
 
-static void ProcessNode(ASTNode Node, IndexProvider &IdxProvider) {
+static void ProcessNode(ASTLocation Node, IndexProvider &IdxProvider) {
   assert(Node.isValid());
 
   Decl *D = 0;
@@ -214,7 +214,7 @@
     IdxProvider.IndexAST(TU);
   }
 
-  ASTNode Node;
+  ASTLocation Node;
   const std::string &FirstFile = TUnits[0]->Filename;
   ASTUnit *FirstAST = TUnits[0]->AST.get();