aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Frontend/ASTUnit.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Frontend/ASTUnit.h')
-rw-r--r--include/clang/Frontend/ASTUnit.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index 9573777b5f6f..7dfabbadd8fd 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -18,6 +18,7 @@
#include "llvm/ADT/OwningPtr.h"
#include "clang/Frontend/TextDiagnosticBuffer.h"
#include "clang/Basic/FileManager.h"
+#include "clang/Index/ASTLocation.h"
#include <string>
namespace clang {
@@ -32,6 +33,8 @@ namespace clang {
class ASTContext;
class Decl;
+using namespace idx;
+
/// \brief Utility class for loading a ASTContext from a PCH file.
///
class ASTUnit {
@@ -50,9 +53,11 @@ class ASTUnit {
// FIXME: This is temporary; eventually, CIndex will always do this.
bool OnlyLocalDecls;
+ // Critical optimization when using clang_getCursor().
+ ASTLocation LastLoc;
+
ASTUnit(const ASTUnit&); // DO NOT IMPLEMENT
ASTUnit &operator=(const ASTUnit &); // DO NOT IMPLEMENT
- ASTUnit();
public:
ASTUnit(DiagnosticClient *diagClient = NULL);
@@ -80,6 +85,9 @@ public:
bool getOnlyLocalDecls() const { return OnlyLocalDecls; }
+ void setLastASTLocation(ASTLocation ALoc) { LastLoc = ALoc; }
+ ASTLocation getLastASTLocation() const { return LastLoc; }
+
/// \brief Create a ASTUnit from a PCH file.
///
/// \param Filename - The PCH file to load.