summaryrefslogtreecommitdiff
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.h38
1 files changed, 30 insertions, 8 deletions
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index 89eb3b8821ca0..9573777b5f6fb 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -16,6 +16,8 @@
#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/OwningPtr.h"
+#include "clang/Frontend/TextDiagnosticBuffer.h"
+#include "clang/Basic/FileManager.h"
#include <string>
namespace clang {
@@ -23,6 +25,7 @@ namespace clang {
class FileEntry;
class SourceManager;
class Diagnostic;
+ class TextDiagnosticBuffer;
class HeaderSearch;
class TargetInfo;
class Preprocessor;
@@ -32,18 +35,27 @@ namespace clang {
/// \brief Utility class for loading a ASTContext from a PCH file.
///
class ASTUnit {
- Diagnostic &Diags;
+ Diagnostic Diags;
+ FileManager FileMgr;
+
SourceManager SourceMgr;
llvm::OwningPtr<HeaderSearch> HeaderInfo;
llvm::OwningPtr<TargetInfo> Target;
llvm::OwningPtr<Preprocessor> PP;
llvm::OwningPtr<ASTContext> Ctx;
-
+ bool tempFile;
+
+ // OnlyLocalDecls - when true, walking this AST should only visit declarations
+ // that come from the AST itself, not from included precompiled headers.
+ // FIXME: This is temporary; eventually, CIndex will always do this.
+ bool OnlyLocalDecls;
+
ASTUnit(const ASTUnit&); // DO NOT IMPLEMENT
ASTUnit &operator=(const ASTUnit &); // DO NOT IMPLEMENT
- ASTUnit(Diagnostic &_Diag);
+ ASTUnit();
public:
+ ASTUnit(DiagnosticClient *diagClient = NULL);
~ASTUnit();
const SourceManager &getSourceManager() const { return SourceMgr; }
@@ -58,14 +70,23 @@ public:
const Diagnostic &getDiagnostic() const { return Diags; }
Diagnostic &getDiagnostic() { return Diags; }
- FileManager &getFileManager();
+ const FileManager &getFileManager() const { return FileMgr; }
+ FileManager &getFileManager() { return FileMgr; }
+
const std::string &getOriginalSourceFileName();
+ const std::string &getPCHFileName();
+ void unlinkTemporaryFile() { tempFile = true; }
+
+ bool getOnlyLocalDecls() const { return OnlyLocalDecls; }
+
/// \brief Create a ASTUnit from a PCH file.
///
/// \param Filename - The PCH file to load.
///
- /// \param Diags - The Diagnostic implementation to use.
+ /// \param diagClient - The diagnostics client to use. Specify NULL
+ /// to use a default client that emits warnings/errors to standard error.
+ /// The ASTUnit objects takes ownership of this object.
///
/// \param FileMgr - The FileManager to use.
///
@@ -74,9 +95,10 @@ public:
///
/// \returns - The initialized ASTUnit or null if the PCH failed to load.
static ASTUnit *LoadFromPCHFile(const std::string &Filename,
- Diagnostic &Diags,
- FileManager &FileMgr,
- std::string *ErrMsg = 0);
+ std::string *ErrMsg = 0,
+ DiagnosticClient *diagClient = NULL,
+ bool OnlyLocalDecls = false,
+ bool UseBumpAllocator = false);
};
} // namespace clang