Move the 'ResolveLocationInAST' function from the Frontend library to the Index library.

Also, cut down its comments; more comments will be added to ASTLocation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74860 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h
index 7845e8f..2ad44da 100644
--- a/include/clang/Frontend/Utils.h
+++ b/include/clang/Frontend/Utils.h
@@ -34,12 +34,6 @@
 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 @@
 /// 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 0000000..e78ef8a
--- /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
similarity index 97%
rename from lib/Frontend/ResolveLocation.cpp
rename to lib/Index/ResolveLocation.cpp
index 9fbae30..b9df702 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 @@
 
 /// \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 dd1ced4..37ecbd9 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"