aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Frontend/Utils.h32
-rw-r--r--include/clang/Index/Utils.h35
-rw-r--r--lib/Index/ResolveLocation.cpp (renamed from lib/Frontend/ResolveLocation.cpp)6
-rw-r--r--tools/index-test/index-test.cpp2
4 files changed, 39 insertions, 36 deletions
diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h
index 7845e8f7cf..2ad44da999 100644
--- a/include/clang/Frontend/Utils.h
+++ b/include/clang/Frontend/Utils.h
@@ -34,12 +34,6 @@ class PreprocessorFactory;
class LangOptions;
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.
@@ -82,32 +76,6 @@ void AttachDependencyFileGen(Preprocessor *PP, llvm::raw_ostream *OS,
/// a seekable stream.
void CacheTokens(Preprocessor& PP, llvm::raw_fd_ostream* OS);
-/// \brief Returns the AST node that a source location points to.
-///
-/// Returns a pair of Decl* and Stmt*. If no AST node is found for the source
-/// location, the pair will contain null pointers.
-///
-/// If the source location points to just a declaration, the statement part of
-/// the pair will be null, e.g.,
-/// @code
-/// int foo;
-/// @endcode
-/// If the source location points at 'foo', the pair will contain the VarDecl
-/// of foo and a null Stmt.
-///
-/// If the source location points to a statement node, the returned declaration
-/// will be the immediate 'parent' declaration of the statement node, e.g.,
-/// @code
-/// void f() {
-/// int foo = 100;
-/// ++foo;
-/// }
-/// @endcode
-/// Pointing at '100' will return a <VarDecl 'foo', IntegerLiteral '100'> pair.
-/// Pointing at '++foo' will return a <FunctionDecl 'f', UnaryOperator> pair.
-///
-idx::ASTLocation ResolveLocationInAST(ASTContext &Ctx, SourceLocation Loc);
-
} // end namespace clang
#endif
diff --git a/include/clang/Index/Utils.h b/include/clang/Index/Utils.h
new file mode 100644
index 0000000000..e78ef8a155
--- /dev/null
+++ b/include/clang/Index/Utils.h
@@ -0,0 +1,35 @@
+//===--- Utils.h - Misc utilities for indexing-----------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This header contains miscellaneous utilities for indexing related
+// functionality.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_INDEX_UTILS_H
+#define LLVM_CLANG_INDEX_UTILS_H
+
+namespace clang {
+ class ASTContext;
+ class SourceLocation;
+
+namespace idx {
+ class ASTLocation;
+
+/// \brief Returns the ASTLocation that a source location points to.
+///
+/// \returns the resolved ASTLocation or an invalid ASTLocation if the source
+/// location could not be resolved.
+ASTLocation ResolveLocationInAST(ASTContext &Ctx, SourceLocation Loc);
+
+} // end namespace idx
+
+} // end namespace clang
+
+#endif
diff --git a/lib/Frontend/ResolveLocation.cpp b/lib/Index/ResolveLocation.cpp
index 9fbae30a48..b9df702904 100644
--- a/lib/Frontend/ResolveLocation.cpp
+++ b/lib/Index/ResolveLocation.cpp
@@ -8,11 +8,11 @@
//===----------------------------------------------------------------------===//
//
// This defines the ResolveLocationInAST function, which resolves a
-// source location into a <Decl *, Stmt *> pair.
+// source location into a ASTLocation.
//
//===----------------------------------------------------------------------===//
-#include "clang/Frontend/Utils.h"
+#include "clang/Index/Utils.h"
#include "clang/Index/ASTLocation.h"
#include "clang/AST/DeclVisitor.h"
#include "clang/AST/StmtVisitor.h"
@@ -322,7 +322,7 @@ void LocResolverBase::print(Stmt *Node) {
/// \brief Returns the AST node that a source location points to.
///
-ASTLocation clang::ResolveLocationInAST(ASTContext &Ctx, SourceLocation Loc) {
+ASTLocation idx::ResolveLocationInAST(ASTContext &Ctx, SourceLocation Loc) {
if (Loc.isInvalid())
return ASTLocation();
diff --git a/tools/index-test/index-test.cpp b/tools/index-test/index-test.cpp
index dd1ced45ce..37ecbd928f 100644
--- a/tools/index-test/index-test.cpp
+++ b/tools/index-test/index-test.cpp
@@ -38,8 +38,8 @@
#include "clang/Index/TranslationUnit.h"
#include "clang/Index/ASTLocation.h"
#include "clang/Index/DeclReferenceMap.h"
+#include "clang/Index/Utils.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"