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.
/// 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
--- /dev/null
+//===--- 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
//===----------------------------------------------------------------------===//
//
// 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"
/// \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();
#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"