summaryrefslogtreecommitdiffstats
path: root/include/clang/Frontend/Utils.h
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-06-27 10:45:02 +0000
committered <ed@FreeBSD.org>2009-06-27 10:45:02 +0000
commitc1ff020ff2d3e7ba86f7ab986ac7569c34f2ab1a (patch)
tree2c5a83521a20c02e7805581a174008aa9bc23579 /include/clang/Frontend/Utils.h
parent14660dbe9881f68a6cc2b9f014e1fb7b7228bca4 (diff)
downloadFreeBSD-src-c1ff020ff2d3e7ba86f7ab986ac7569c34f2ab1a.zip
FreeBSD-src-c1ff020ff2d3e7ba86f7ab986ac7569c34f2ab1a.tar.gz
Import Clang r74383.
Diffstat (limited to 'include/clang/Frontend/Utils.h')
-rw-r--r--include/clang/Frontend/Utils.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h
index 41eb31a..77df60c 100644
--- a/include/clang/Frontend/Utils.h
+++ b/include/clang/Frontend/Utils.h
@@ -32,6 +32,10 @@ class IdentifierTable;
class SourceManager;
class PreprocessorFactory;
class LangOptions;
+class Decl;
+class Stmt;
+class ASTContext;
+class SourceLocation;
/// ProcessWarningOptions - Initialize the diagnostic client and process the
/// warning options specified on the command line.
@@ -74,6 +78,33 @@ 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.
+///
+std::pair<Decl *, Stmt *> ResolveLocationInAST(ASTContext &Ctx,
+ SourceLocation Loc);
+
} // end namespace clang
#endif
OpenPOWER on IntegriCloud