From ccbcb70ee96cb67ed6c8b4142d050f3a6764edd7 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Mon, 6 Jul 2009 21:34:47 +0000 Subject: [PATCH] Move ASTLocation and DeclReferenceMap from the AST library to the Index library. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74859 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Frontend/Utils.h | 5 ++++- include/clang/{AST => Index}/ASTLocation.h | 8 ++++++-- include/clang/{AST => Index}/DeclReferenceMap.h | 10 +++++++--- lib/Frontend/ResolveLocation.cpp | 3 ++- lib/{AST => Index}/ASTLocation.cpp | 5 +++-- lib/{AST => Index}/DeclReferenceMap.cpp | 7 ++++--- tools/index-test/index-test.cpp | 4 ++-- 7 files changed, 28 insertions(+), 14 deletions(-) rename include/clang/{AST => Index}/ASTLocation.h (93%) rename include/clang/{AST => Index}/DeclReferenceMap.h (92%) rename lib/{AST => Index}/ASTLocation.cpp (95%) rename lib/{AST => Index}/DeclReferenceMap.cpp (95%) diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h index 3153e400ef..7845e8f7cf 100644 --- a/include/clang/Frontend/Utils.h +++ b/include/clang/Frontend/Utils.h @@ -36,7 +36,10 @@ class Decl; class Stmt; class ASTContext; class SourceLocation; + +namespace idx { class ASTLocation; +} /// ProcessWarningOptions - Initialize the diagnostic client and process the /// warning options specified on the command line. @@ -103,7 +106,7 @@ void CacheTokens(Preprocessor& PP, llvm::raw_fd_ostream* OS); /// Pointing at '100' will return a pair. /// Pointing at '++foo' will return a pair. /// -ASTLocation ResolveLocationInAST(ASTContext &Ctx, SourceLocation Loc); +idx::ASTLocation ResolveLocationInAST(ASTContext &Ctx, SourceLocation Loc); } // end namespace clang diff --git a/include/clang/AST/ASTLocation.h b/include/clang/Index/ASTLocation.h similarity index 93% rename from include/clang/AST/ASTLocation.h rename to include/clang/Index/ASTLocation.h index f6ace25ca7..4404644e56 100644 --- a/include/clang/AST/ASTLocation.h +++ b/include/clang/Index/ASTLocation.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_AST_ASTLOCATION_H -#define LLVM_CLANG_AST_ASTLOCATION_H +#ifndef LLVM_CLANG_INDEX_ASTLOCATION_H +#define LLVM_CLANG_INDEX_ASTLOCATION_H #include @@ -24,6 +24,8 @@ namespace clang { class Decl; class Stmt; +namespace idx { + /// \brief Represents a Decl or a Stmt and its immediate Decl parent. It's /// immutable. class ASTLocation { @@ -61,6 +63,8 @@ public: void print(llvm::raw_ostream &OS); }; +} // namespace idx + } // namespace clang #endif diff --git a/include/clang/AST/DeclReferenceMap.h b/include/clang/Index/DeclReferenceMap.h similarity index 92% rename from include/clang/AST/DeclReferenceMap.h rename to include/clang/Index/DeclReferenceMap.h index 9dd5d47fef..130ca387d5 100644 --- a/include/clang/AST/DeclReferenceMap.h +++ b/include/clang/Index/DeclReferenceMap.h @@ -12,15 +12,17 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_AST_DECLREFERENCEMAP_H -#define LLVM_CLANG_AST_DECLREFERENCEMAP_H +#ifndef LLVM_CLANG_INDEX_DECLREFERENCEMAP_H +#define LLVM_CLANG_INDEX_DECLREFERENCEMAP_H -#include "clang/AST/ASTLocation.h" +#include "clang/Index/ASTLocation.h" #include namespace clang { class ASTContext; class NamedDecl; + +namespace idx { /// \brief Maps NamedDecls with the ASTLocations that reference them. /// @@ -76,6 +78,8 @@ public: private: mutable MapTy Map; }; + +} // end idx namespace } // end clang namespace diff --git a/lib/Frontend/ResolveLocation.cpp b/lib/Frontend/ResolveLocation.cpp index c2d32bbc90..9fbae30a48 100644 --- a/lib/Frontend/ResolveLocation.cpp +++ b/lib/Frontend/ResolveLocation.cpp @@ -13,13 +13,14 @@ //===----------------------------------------------------------------------===// #include "clang/Frontend/Utils.h" -#include "clang/AST/ASTLocation.h" +#include "clang/Index/ASTLocation.h" #include "clang/AST/DeclVisitor.h" #include "clang/AST/StmtVisitor.h" #include "clang/Lex/Lexer.h" #include "clang/Basic/SourceManager.h" #include "llvm/Support/Compiler.h" using namespace clang; +using namespace idx; namespace { diff --git a/lib/AST/ASTLocation.cpp b/lib/Index/ASTLocation.cpp similarity index 95% rename from lib/AST/ASTLocation.cpp rename to lib/Index/ASTLocation.cpp index e72acf0793..4b95d9d554 100644 --- a/lib/AST/ASTLocation.cpp +++ b/lib/Index/ASTLocation.cpp @@ -1,4 +1,4 @@ -//===--- ASTLocation.h - A pair --------------------*- C++ -*-===// +//===--- ASTLocation.cpp - A pair ------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -11,11 +11,12 @@ // //===----------------------------------------------------------------------===// -#include "clang/AST/ASTLocation.h" +#include "clang/Index/ASTLocation.h" #include "clang/AST/Decl.h" #include "clang/AST/Stmt.h" #include "clang/AST/Expr.h" using namespace clang; +using namespace idx; static bool isContainedInStatement(Stmt *Node, Stmt *Parent) { assert(Node && Parent && "Passed null Node or Parent"); diff --git a/lib/AST/DeclReferenceMap.cpp b/lib/Index/DeclReferenceMap.cpp similarity index 95% rename from lib/AST/DeclReferenceMap.cpp rename to lib/Index/DeclReferenceMap.cpp index 41f53fdd52..841d7fb2fb 100644 --- a/lib/AST/DeclReferenceMap.cpp +++ b/lib/Index/DeclReferenceMap.cpp @@ -1,4 +1,4 @@ -//===--- DeclReferenceMap.h - Map Decls to their references -----*- C++ -*-===// +//===--- DeclReferenceMap.cpp - Map Decls to their references ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -12,14 +12,15 @@ // //===----------------------------------------------------------------------===// -#include "clang/AST/DeclReferenceMap.h" +#include "clang/Index/DeclReferenceMap.h" +#include "clang/Index/ASTLocation.h" #include "clang/AST/Decl.h" #include "clang/AST/Stmt.h" -#include "clang/AST/ASTLocation.h" #include "clang/AST/DeclVisitor.h" #include "clang/AST/StmtVisitor.h" #include "llvm/Support/Compiler.h" using namespace clang; +using namespace idx; namespace { diff --git a/tools/index-test/index-test.cpp b/tools/index-test/index-test.cpp index f44cd53b77..dd1ced45ce 100644 --- a/tools/index-test/index-test.cpp +++ b/tools/index-test/index-test.cpp @@ -36,13 +36,13 @@ #include "clang/Index/IndexProvider.h" #include "clang/Index/Entity.h" #include "clang/Index/TranslationUnit.h" +#include "clang/Index/ASTLocation.h" +#include "clang/Index/DeclReferenceMap.h" #include "clang/Frontend/ASTUnit.h" #include "clang/Frontend/Utils.h" #include "clang/Frontend/CommandLineSourceLoc.h" #include "clang/AST/Decl.h" #include "clang/AST/Expr.h" -#include "clang/AST/ASTLocation.h" -#include "clang/AST/DeclReferenceMap.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/SourceManager.h" #include "llvm/Support/CommandLine.h" -- 2.40.0