diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-06 21:34:20 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-06 21:34:20 +0000 |
commit | 874012b1fb80dff2ec227c726a0c63d55e3db63f (patch) | |
tree | 70eab7283470c4b7f92f2ab777edf8fdea9397ff /include/clang | |
parent | 145918ca119904b6abe8b41aae0cbbf9a7247905 (diff) |
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
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/AST/ASTLocation.h (renamed from include/clang/AST/ASTNode.h) | 18 | ||||
-rw-r--r-- | include/clang/AST/DeclReferenceMap.h | 34 | ||||
-rw-r--r-- | include/clang/Frontend/Utils.h | 4 |
3 files changed, 28 insertions, 28 deletions
diff --git a/include/clang/AST/ASTNode.h b/include/clang/AST/ASTLocation.h index 852e946380..f6ace25ca7 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 @@ namespace clang { /// \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 @@ public: /// \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 b2068fb275..9dd5d47fef 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 @@ class DeclReferenceMap { 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 7e7efbce57..3153e400ef 100644 --- a/include/clang/Frontend/Utils.h +++ b/include/clang/Frontend/Utils.h @@ -36,7 +36,7 @@ class Decl; 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 @@ void CacheTokens(Preprocessor& PP, llvm::raw_fd_ostream* OS); /// 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 |