aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/clang/Basic/SourceManager.h17
-rw-r--r--include/clang/Frontend/PCHBitCodes.h40
-rw-r--r--include/clang/Frontend/PCHReader.h9
-rw-r--r--include/clang/Frontend/PCHWriter.h2
-rw-r--r--include/clang/Lex/Preprocessor.h1
5 files changed, 65 insertions, 4 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index d068e44f7c..dcf344e412 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -183,7 +183,7 @@ namespace SrcMgr {
unsigned SpellingLoc;
/// InstantiationLocStart/InstantiationLocEnd - In a macro expansion, these
- /// indicate the start and end of the instantiation. In object-line macros,
+ /// indicate the start and end of the instantiation. In object-like macros,
/// these will be the same. In a function-like macro instantiation, the
/// start will be the identifier and the end will be the ')'.
unsigned InstantiationLocStart, InstantiationLocEnd;
@@ -610,7 +610,20 @@ public:
/// Read - Reconstitute a SourceManager from Bitcode.
static SourceManager* CreateAndRegister(llvm::Deserializer& S,
FileManager &FMgr);
-
+
+ // Iteration over the source location entry table.
+ typedef std::vector<SrcMgr::SLocEntry>::const_iterator sloc_entry_iterator;
+
+ sloc_entry_iterator sloc_entry_begin() const {
+ return SLocEntryTable.begin();
+ }
+
+ sloc_entry_iterator sloc_entry_end() const {
+ return SLocEntryTable.end();
+ }
+
+ unsigned sloc_entry_size() const { return SLocEntryTable.size(); }
+
private:
friend class SrcMgr::ContentCache; // Used for deserialization.
diff --git a/include/clang/Frontend/PCHBitCodes.h b/include/clang/Frontend/PCHBitCodes.h
index 8835098361..00bd1cfac2 100644
--- a/include/clang/Frontend/PCHBitCodes.h
+++ b/include/clang/Frontend/PCHBitCodes.h
@@ -31,7 +31,19 @@ namespace clang {
/// \brief The PCH block, which acts as a container around the
/// full PCH block.
PCH_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID,
-
+
+ /// \brief The block containing information about the language
+ /// options used to build this precompiled header.
+ LANGUAGE_OPTIONS_BLOCK_ID,
+
+ /// \brief The block containing information about the source
+ /// manager.
+ SOURCE_MANAGER_BLOCK_ID,
+
+ /// \brief The block containing information about the
+ /// preprocessor.
+ PREPROCESSOR_BLOCK_ID,
+
/// \brief The block containing the definitions of all of the
/// types used within the PCH file.
TYPES_BLOCK_ID,
@@ -55,6 +67,30 @@ namespace clang {
DECL_OFFSETS_BLOCK_ID
};
+ /// \brief Record types used within a source manager block.
+ enum SourceManagerRecordTypes {
+ /// \brief Describes a source location entry (SLocEntry) for a
+ /// file.
+ SM_SLOC_FILE_ENTRY = 1,
+ /// \brief Describes a source location entry (SLocEntry) for a
+ /// buffer.
+ SM_SLOC_BUFFER_ENTRY = 2,
+ /// \brief Describes a blob that contains the data for a buffer
+ /// entry. This kind of record always directly follows a
+ /// SM_SLOC_BUFFER_ENTRY record.
+ SM_SLOC_BUFFER_BLOB = 3,
+ /// \brief Describes a source location entry (SLocEntry) for a
+ /// macro instantiation.
+ SM_SLOC_INSTANTIATION_ENTRY = 4
+ };
+
+ /// \defgroup PCHAST Precompiled header AST constants
+ ///
+ /// The constants in this group describe various components of the
+ /// abstract syntax tree within a precompiled header.
+ ///
+ /// @{
+
/// \brief Predefined type IDs.
///
/// These type IDs correspond to predefined types in the AST
@@ -233,6 +269,8 @@ namespace clang {
enum DeclOffsetCode {
DECL_OFFSET = 1
};
+
+ /// @}
}
} // end namespace clang
diff --git a/include/clang/Frontend/PCHReader.h b/include/clang/Frontend/PCHReader.h
index 1338d3c03b..fe7632896e 100644
--- a/include/clang/Frontend/PCHReader.h
+++ b/include/clang/Frontend/PCHReader.h
@@ -34,6 +34,7 @@ namespace clang {
class ASTContext;
class Decl;
class DeclContext;
+class Preprocessor;
/// \brief Reads a precompiled head containing the contents of a
/// translation unit.
@@ -48,6 +49,9 @@ class DeclContext;
/// required when traversing the AST. Only those AST nodes that are
/// actually required will be de-serialized.
class PCHReader : public ExternalASTSource {
+ /// \brief The preprocessor that will be loading the source file.
+ Preprocessor &PP;
+
/// \brief The AST context into which we'll read the PCH file.
ASTContext &Context;
@@ -95,6 +99,7 @@ class PCHReader : public ExternalASTSource {
DeclContextOffsetsMap DeclContextOffsets;
bool ReadPCHBlock();
+ bool ReadSourceManagerBlock();
bool ReadTypeOffsets();
bool ReadDeclOffsets();
@@ -108,7 +113,9 @@ class PCHReader : public ExternalASTSource {
public:
typedef llvm::SmallVector<uint64_t, 64> RecordData;
- PCHReader(ASTContext &Context) : Context(Context), Buffer() { }
+ PCHReader(Preprocessor &PP, ASTContext &Context)
+ : PP(PP), Context(Context), Buffer() { }
+
~PCHReader();
bool ReadPCH(const std::string &FileName);
diff --git a/include/clang/Frontend/PCHWriter.h b/include/clang/Frontend/PCHWriter.h
index 99876e9002..9b5f15ecf7 100644
--- a/include/clang/Frontend/PCHWriter.h
+++ b/include/clang/Frontend/PCHWriter.h
@@ -30,6 +30,7 @@ namespace llvm {
namespace clang {
class ASTContext;
+class SourceManager;
/// \brief Writes a precompiled header containing the contents of a
/// translation unit.
@@ -74,6 +75,7 @@ class PCHWriter {
/// \brief The type ID that will be assigned to the next new type.
unsigned NextTypeID;
+ void WriteSourceManagerBlock(SourceManager &SourceMgr);
void WriteType(const Type *T);
void WriteTypesBlock(ASTContext &Context);
uint64_t WriteDeclContextLexicalBlock(ASTContext &Context, DeclContext *DC);
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index 0e16ef8287..68cb372c47 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -782,6 +782,7 @@ class PreprocessorFactory {
public:
virtual ~PreprocessorFactory();
virtual Preprocessor* CreatePreprocessor() = 0;
+ virtual bool FinishInitialization(Preprocessor *PP);
};
} // end namespace clang