aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/clang/Serialization/ASTReader.h88
1 files changed, 54 insertions, 34 deletions
diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h
index 5473b2d5da..79186c7ad7 100644
--- a/include/clang/Serialization/ASTReader.h
+++ b/include/clang/Serialization/ASTReader.h
@@ -57,12 +57,15 @@ class GotoStmt;
class LabelStmt;
class MacroDefinition;
class NamedDecl;
-class ASTDeserializationListener;
class Preprocessor;
class Sema;
class SwitchCase;
+class ASTDeserializationListener;
class ASTReader;
class ASTDeclReader;
+class ASTStmtReader;
+class ASTIdentifierLookupTrait;
+class TypeLocReader;
struct HeaderFileInfo;
struct PCHPredefinesBlock {
@@ -169,6 +172,9 @@ public:
enum ASTReadResult { Success, Failure, IgnorePCH };
friend class PCHValidator;
friend class ASTDeclReader;
+ friend class ASTStmtReader;
+ friend class ASTIdentifierLookupTrait;
+ friend class TypeLocReader;
private:
/// \brief The receiver of some callbacks invoked by ASTReader.
llvm::OwningPtr<ASTReaderListener> Listener;
@@ -289,6 +295,10 @@ private:
/// instance and factory methods.
void *SelectorLookupTable;
+ /// \brief Method selectors used in a @selector expression. Used for
+ /// implementation of -Wselector.
+ llvm::SmallVector<uint64_t, 64> ReferencedSelectorsData;
+
// === Declarations ===
/// DeclsCursor - This is a cursor to the start of the DECLS_BLOCK block. It
@@ -303,6 +313,14 @@ private:
/// by the declaration ID (-1).
const uint32_t *DeclOffsets;
+ /// \brief A snapshot of the pending instantiations in the chain.
+ ///
+ /// This record tracks the instantiations that Sema has to perform at the
+ /// end of the TU. It consists of a pair of values for every pending
+ /// instantiation where the first value is the ID of the decl and the second
+ /// is the instantiation location.
+ llvm::SmallVector<uint64_t, 64> PendingInstantiations;
+
// === Types ===
/// \brief The number of types in this AST file.
@@ -474,10 +492,6 @@ private:
/// \brief Fields containing data that is used for generating diagnostics
//@{
- /// \brief Method selectors used in a @selector expression. Used for
- /// implementation of -Wselector.
- llvm::SmallVector<uint64_t, 64> ReferencedSelectorsData;
-
/// \brief A snapshot of Sema's unused file-scoped variable tracking, for
/// generating warnings.
llvm::SmallVector<uint64_t, 16> UnusedFileScopedDecls;
@@ -503,14 +517,6 @@ private:
/// local external declarations.
llvm::SmallVector<uint64_t, 16> LocallyScopedExternalDecls;
- /// \brief A snapshot of the pwnsinf instantiations in the chain.
- ///
- /// This record tracks the instantiations that Sema has to perform at the end
- /// of the TU. It consists of a pair of values for every pending instantiation
- /// where the first value is the ID of the decl and the second is the
- /// instantiation location.
- llvm::SmallVector<uint64_t, 64> PendingInstantiations;
-
/// \brief The IDs of all dynamic class declarations in the chain.
///
/// Sema tracks these because it checks for the key functions being defined
@@ -685,20 +691,26 @@ private:
std::string SuggestedPredefines;
/// \brief Reads a statement from the specified cursor.
- Stmt *ReadStmtFromStream(llvm::BitstreamCursor &Cursor);
+ Stmt *ReadStmtFromStream(PerFileData &F);
void MaybeAddSystemRootToFilename(std::string &Filename);
ASTReadResult ReadASTCore(llvm::StringRef FileName);
ASTReadResult ReadASTBlock(PerFileData &F);
bool CheckPredefinesBuffers();
- bool ParseLineTable(llvm::SmallVectorImpl<uint64_t> &Record);
+ bool ParseLineTable(PerFileData &F, llvm::SmallVectorImpl<uint64_t> &Record);
ASTReadResult ReadSourceManagerBlock(PerFileData &F);
ASTReadResult ReadSLocEntryRecord(unsigned ID);
- llvm::BitstreamCursor &SLocCursorForID(unsigned ID);
+ PerFileData *SLocCursorForID(unsigned ID);
+ SourceLocation getImportLocation(PerFileData *F);
bool ParseLanguageOptions(const llvm::SmallVectorImpl<uint64_t> &Record);
- typedef std::pair<llvm::BitstreamCursor *, uint64_t> RecordLocation;
+ struct RecordLocation {
+ RecordLocation(PerFileData *M, uint64_t O)
+ : F(M), Offset(O) {}
+ PerFileData *F;
+ uint64_t Offset;
+ };
QualType ReadTypeRecord(unsigned Index);
RecordLocation TypeCursorForIndex(unsigned Index);
@@ -837,17 +849,16 @@ public:
/// \brief Reads a TemplateArgumentLocInfo appropriate for the
/// given TemplateArgument kind.
TemplateArgumentLocInfo
- GetTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind,
- llvm::BitstreamCursor &DeclsCursor,
+ GetTemplateArgumentLocInfo(PerFileData &F, TemplateArgument::ArgKind Kind,
const RecordData &Record, unsigned &Idx);
/// \brief Reads a TemplateArgumentLoc.
TemplateArgumentLoc
- ReadTemplateArgumentLoc(llvm::BitstreamCursor &DeclsCursor,
+ ReadTemplateArgumentLoc(PerFileData &F,
const RecordData &Record, unsigned &Idx);
/// \brief Reads a declarator info from the given record.
- TypeSourceInfo *GetTypeSourceInfo(llvm::BitstreamCursor &DeclsCursor,
+ TypeSourceInfo *GetTypeSourceInfo(PerFileData &F,
const RecordData &Record, unsigned &Idx);
/// \brief Resolve and return the translation unit declaration.
@@ -1001,39 +1012,48 @@ public:
TemplateName ReadTemplateName(const RecordData &Record, unsigned &Idx);
/// \brief Read a template argument.
- TemplateArgument ReadTemplateArgument(llvm::BitstreamCursor &DeclsCursor,
+ TemplateArgument ReadTemplateArgument(PerFileData &F,
const RecordData &Record,unsigned &Idx);
/// \brief Read a template parameter list.
- TemplateParameterList *ReadTemplateParameterList(const RecordData &Record,
+ TemplateParameterList *ReadTemplateParameterList(PerFileData &F,
+ const RecordData &Record,
unsigned &Idx);
/// \brief Read a template argument array.
void
ReadTemplateArgumentList(llvm::SmallVector<TemplateArgument, 8> &TemplArgs,
- llvm::BitstreamCursor &DeclsCursor,
- const RecordData &Record, unsigned &Idx);
+ PerFileData &F, const RecordData &Record,
+ unsigned &Idx);
/// \brief Read a UnresolvedSet structure.
void ReadUnresolvedSet(UnresolvedSetImpl &Set,
const RecordData &Record, unsigned &Idx);
/// \brief Read a C++ base specifier.
- CXXBaseSpecifier ReadCXXBaseSpecifier(llvm::BitstreamCursor &DeclsCursor,
+ CXXBaseSpecifier ReadCXXBaseSpecifier(PerFileData &F,
const RecordData &Record,unsigned &Idx);
/// \brief Read a CXXBaseOrMemberInitializer array.
std::pair<CXXBaseOrMemberInitializer **, unsigned>
- ReadCXXBaseOrMemberInitializers(llvm::BitstreamCursor &DeclsCursor,
+ ReadCXXBaseOrMemberInitializers(PerFileData &F,
const RecordData &Record, unsigned &Idx);
+ /// \brief Read a source location from raw form.
+ SourceLocation ReadSourceLocation(PerFileData &Module, unsigned Raw) {
+ (void)Module; // No remapping yet
+ return SourceLocation::getFromRawEncoding(Raw);
+ }
+
/// \brief Read a source location.
- SourceLocation ReadSourceLocation(const RecordData &Record, unsigned& Idx) {
- return SourceLocation::getFromRawEncoding(Record[Idx++]);
+ SourceLocation ReadSourceLocation(PerFileData &Module,
+ const RecordData &Record, unsigned& Idx) {
+ return ReadSourceLocation(Module, Record[Idx++]);
}
/// \brief Read a source range.
- SourceRange ReadSourceRange(const RecordData &Record, unsigned& Idx);
+ SourceRange ReadSourceRange(PerFileData &F,
+ const RecordData &Record, unsigned& Idx);
/// \brief Read an integral value
llvm::APInt ReadAPInt(const RecordData &Record, unsigned &Idx);
@@ -1050,13 +1070,13 @@ public:
CXXTemporary *ReadCXXTemporary(const RecordData &Record, unsigned &Idx);
/// \brief Reads attributes from the current stream position.
- void ReadAttributes(llvm::BitstreamCursor &DeclsCursor, AttrVec &Attrs);
+ void ReadAttributes(PerFileData &F, AttrVec &Attrs);
/// \brief Reads a statement.
- Stmt *ReadStmt(llvm::BitstreamCursor &Cursor);
+ Stmt *ReadStmt(PerFileData &F);
/// \brief Reads an expression.
- Expr *ReadExpr(llvm::BitstreamCursor &Cursor);
+ Expr *ReadExpr(PerFileData &F);
/// \brief Reads a sub-statement operand during statement reading.
Stmt *ReadSubStmt() {
@@ -1072,7 +1092,7 @@ public:
Expr *ReadSubExpr();
/// \brief Reads the macro record located at the given offset.
- void ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset);
+ void ReadMacroRecord(PerFileData &F, uint64_t Offset);
/// \brief Read the set of macros defined by this external macro source.
virtual void ReadDefinedMacros();