summaryrefslogtreecommitdiffstats
path: root/include/clang/Frontend/PCHReader.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Frontend/PCHReader.h')
-rw-r--r--include/clang/Frontend/PCHReader.h53
1 files changed, 32 insertions, 21 deletions
diff --git a/include/clang/Frontend/PCHReader.h b/include/clang/Frontend/PCHReader.h
index 065006f..73c1bf4 100644
--- a/include/clang/Frontend/PCHReader.h
+++ b/include/clang/Frontend/PCHReader.h
@@ -21,6 +21,7 @@
#include "clang/AST/Type.h"
#include "clang/AST/TemplateBase.h"
#include "clang/Lex/ExternalPreprocessorSource.h"
+#include "clang/Lex/PreprocessingRecord.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/SourceManager.h"
@@ -53,6 +54,7 @@ class Decl;
class DeclContext;
class GotoStmt;
class LabelStmt;
+class MacroDefinition;
class NamedDecl;
class Preprocessor;
class Sema;
@@ -106,7 +108,7 @@ public:
}
/// \brief Receives a HeaderFileInfo entry.
- virtual void ReadHeaderFileInfo(const HeaderFileInfo &HFI) {}
+ virtual void ReadHeaderFileInfo(const HeaderFileInfo &HFI, unsigned ID) {}
/// \brief Receives __COUNTER__ value.
virtual void ReadCounter(unsigned Value) {}
@@ -130,8 +132,11 @@ public:
FileID PCHBufferID,
llvm::StringRef OriginalFileName,
std::string &SuggestedPredefines);
- virtual void ReadHeaderFileInfo(const HeaderFileInfo &HFI);
+ virtual void ReadHeaderFileInfo(const HeaderFileInfo &HFI, unsigned ID);
virtual void ReadCounter(unsigned Value);
+
+private:
+ void Error(const char *Msg);
};
/// \brief Reads a precompiled head containing the contents of a
@@ -148,13 +153,14 @@ public:
/// actually required will be de-serialized.
class PCHReader
: public ExternalPreprocessorSource,
+ public ExternalPreprocessingRecordSource,
public ExternalSemaSource,
public IdentifierInfoLookup,
public ExternalIdentifierLookup,
public ExternalSLocEntrySource {
public:
enum PCHReadResult { Success, Failure, IgnorePCH };
-
+ friend class PCHValidator;
private:
/// \ brief The receiver of some callbacks invoked by PCHReader.
llvm::OwningPtr<PCHReaderListener> Listener;
@@ -293,12 +299,17 @@ private:
/// been loaded.
llvm::SmallVector<Selector, 16> SelectorsLoaded;
- /// \brief A sorted array of source ranges containing comments.
- SourceRange *Comments;
-
- /// \brief The number of source ranges in the Comments array.
- unsigned NumComments;
-
+ /// \brief Offsets of all of the macro definitions in the preprocessing
+ /// record in the PCH file.
+ const uint32_t *MacroDefinitionOffsets;
+
+ /// \brief The macro definitions we have already loaded.
+ llvm::SmallVector<MacroDefinition *, 16> MacroDefinitionsLoaded;
+
+ /// \brief The number of preallocated preprocessing entities in the
+ /// preprocessing record.
+ unsigned NumPreallocatedPreprocessingEntities;
+
/// \brief The set of external definitions stored in the the PCH
/// file.
llvm::SmallVector<uint64_t, 16> ExternalDefinitions;
@@ -472,7 +483,7 @@ private:
///
/// This routine should only be used for fatal errors that have to
/// do with non-routine failures (e.g., corrupted PCH file).
- bool Error(const char *Msg);
+ void Error(const char *Msg);
PCHReader(const PCHReader&); // do not implement
PCHReader &operator=(const PCHReader &); // do not implement
@@ -524,9 +535,7 @@ public:
}
/// \brief Set the Preprocessor to use.
- void setPreprocessor(Preprocessor &pp) {
- PP = &pp;
- }
+ void setPreprocessor(Preprocessor &pp);
/// \brief Sets and initializes the given Context.
void InitializeContext(ASTContext &Context);
@@ -547,14 +556,9 @@ public:
/// which contains a (typically-empty) subset of the predefines
/// build prior to including the precompiled header.
const std::string &getSuggestedPredefines() { return SuggestedPredefines; }
-
- /// \brief Reads the source ranges that correspond to comments from
- /// an external AST source.
- ///
- /// \param Comments the contents of this vector will be
- /// replaced with the sorted set of source ranges corresponding to
- /// comments in the source code.
- virtual void ReadComments(std::vector<SourceRange> &Comments);
+
+ /// \brief Read preprocessed entities into the
+ virtual void ReadPreprocessedEntities();
/// \brief Reads a TemplateArgumentLocInfo appropriate for the
/// given TemplateArgument kind.
@@ -724,6 +728,9 @@ public:
/// \brief Read the set of macros defined by this external macro source.
virtual void ReadDefinedMacros();
+ /// \brief Retrieve the macro definition with the given ID.
+ MacroDefinition *getMacroDefinition(pch::IdentID ID);
+
/// \brief Retrieve the AST context that this PCH reader
/// supplements.
ASTContext *getContext() { return Context; }
@@ -790,6 +797,10 @@ private:
uint64_t Offset;
};
+inline void PCHValidator::Error(const char *Msg) {
+ Reader.Error(Msg);
+}
+
} // end namespace clang
#endif
OpenPOWER on IntegriCloud