summaryrefslogtreecommitdiff
path: root/include/clang/Serialization
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Serialization')
-rw-r--r--include/clang/Serialization/ASTBitCodes.h20
-rw-r--r--include/clang/Serialization/ASTReader.h25
-rw-r--r--include/clang/Serialization/ASTWriter.h9
-rw-r--r--include/clang/Serialization/ChainedIncludesSource.h76
4 files changed, 126 insertions, 4 deletions
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h
index 68fd91d4c0696..1cfd458a38647 100644
--- a/include/clang/Serialization/ASTBitCodes.h
+++ b/include/clang/Serialization/ASTBitCodes.h
@@ -490,7 +490,11 @@ namespace clang {
/// \brief The ObjC 'Class' type.
PREDEF_TYPE_OBJC_CLASS = 27,
/// \brief The ObjC 'SEL' type.
- PREDEF_TYPE_OBJC_SEL = 28
+ PREDEF_TYPE_OBJC_SEL = 28,
+ /// \brief The 'unknown any' placeholder type.
+ PREDEF_TYPE_UNKNOWN_ANY = 29,
+ /// \brief The placeholder type for bound member functions.
+ PREDEF_TYPE_BOUND_MEMBER = 30
};
/// \brief The number of predefined type IDs that are reserved for
@@ -622,7 +626,11 @@ namespace clang {
/// \brief NSConstantString type
SPECIAL_TYPE_NS_CONSTANT_STRING = 15,
/// \brief Whether __[u]int128_t identifier is installed.
- SPECIAL_TYPE_INT128_INSTALLED = 16
+ SPECIAL_TYPE_INT128_INSTALLED = 16,
+ /// \brief Cached "auto" deduction type.
+ SPECIAL_TYPE_AUTO_DEDUCT = 17,
+ /// \brief Cached "auto &&" deduction type.
+ SPECIAL_TYPE_AUTO_RREF_DEDUCT = 18
};
/// \brief Record codes for each kind of declaration.
@@ -636,6 +644,8 @@ namespace clang {
DECL_TRANSLATION_UNIT = 50,
/// \brief A TypedefDecl record.
DECL_TYPEDEF,
+ /// \brief A TypeAliasDecl record.
+ DECL_TYPEALIAS,
/// \brief An EnumDecl record.
DECL_ENUM,
/// \brief A RecordDecl record.
@@ -872,6 +882,8 @@ namespace clang {
EXPR_BLOCK,
/// \brief A BlockDeclRef record.
EXPR_BLOCK_DECL_REF,
+ /// \brief A GenericSelectionExpr record.
+ EXPR_GENERIC_SELECTION,
// Objective-C
@@ -913,6 +925,8 @@ namespace clang {
STMT_CXX_CATCH,
/// \brief A CXXTryStmt record.
STMT_CXX_TRY,
+ /// \brief A CXXForRangeStmt record.
+ STMT_CXX_FOR_RANGE,
/// \brief A CXXOperatorCallExpr record.
EXPR_CXX_OPERATOR_CALL,
@@ -958,11 +972,13 @@ namespace clang {
EXPR_CXX_UNRESOLVED_LOOKUP, // UnresolvedLookupExpr
EXPR_CXX_UNARY_TYPE_TRAIT, // UnaryTypeTraitExpr
+ EXPR_CXX_EXPRESSION_TRAIT, // ExpressionTraitExpr
EXPR_CXX_NOEXCEPT, // CXXNoexceptExpr
EXPR_OPAQUE_VALUE, // OpaqueValueExpr
EXPR_BINARY_CONDITIONAL_OPERATOR, // BinaryConditionalOperator
EXPR_BINARY_TYPE_TRAIT, // BinaryTypeTraitExpr
+ EXPR_ARRAY_TYPE_TRAIT, // ArrayTypeTraitIntExpr
EXPR_PACK_EXPANSION, // PackExpansionExpr
EXPR_SIZEOF_PACK, // SizeOfPackExpr
diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h
index 424e78c391bcb..da018ab99e659 100644
--- a/include/clang/Serialization/ASTReader.h
+++ b/include/clang/Serialization/ASTReader.h
@@ -69,6 +69,7 @@ class ASTStmtReader;
class ASTIdentifierLookupTrait;
class TypeLocReader;
struct HeaderFileInfo;
+class VersionTuple;
struct PCHPredefinesBlock {
/// \brief The file ID for this predefines buffer in a PCH file.
@@ -213,6 +214,10 @@ private:
/// \brief The AST consumer.
ASTConsumer *Consumer;
+ /// \brief AST buffers for chained PCHs created and stored in memory.
+ /// First (not depending on another) PCH in chain is in front.
+ std::vector<llvm::MemoryBuffer *> ASTBuffers;
+
/// \brief Information that is needed for every module.
struct PerFileData {
PerFileData(ASTFileType Ty);
@@ -806,7 +811,9 @@ private:
///
/// This routine should only be used for fatal errors that have to
/// do with non-routine failures (e.g., corrupted AST file).
- void Error(const char *Msg);
+ void Error(llvm::StringRef Msg);
+ void Error(unsigned DiagID, llvm::StringRef Arg1 = llvm::StringRef(),
+ llvm::StringRef Arg2 = llvm::StringRef());
ASTReader(const ASTReader&); // do not implement
ASTReader &operator=(const ASTReader &); // do not implement
@@ -886,6 +893,13 @@ public:
/// \brief Sets and initializes the given Context.
void InitializeContext(ASTContext &Context);
+ /// \brief Set AST buffers for chained PCHs created and stored in memory.
+ /// First (not depending on another) PCH in chain is first in array.
+ void setASTMemoryBuffers(llvm::MemoryBuffer **bufs, unsigned numBufs) {
+ ASTBuffers.clear();
+ ASTBuffers.insert(ASTBuffers.begin(), bufs, bufs + numBufs);
+ }
+
/// \brief Retrieve the name of the named (primary) AST file
const std::string &getFileName() const { return Chain[0]->FileName; }
@@ -1052,6 +1066,10 @@ public:
/// \brief Print some statistics about AST usage.
virtual void PrintStats();
+ /// Return the amount of memory used by memory buffers, breaking down
+ /// by heap-backed versus mmap'ed memory.
+ virtual void getMemoryBufferSizes(MemoryBufferSizes &sizes) const;
+
/// \brief Initialize the semantic source with the Sema instance
/// being used to perform semantic analysis on the abstract syntax
/// tree.
@@ -1108,7 +1126,7 @@ public:
}
/// \brief Read the source location entry with index ID.
- virtual void ReadSLocEntry(unsigned ID);
+ virtual bool ReadSLocEntry(unsigned ID);
Selector DecodeSelector(unsigned Idx);
@@ -1197,6 +1215,9 @@ public:
// \brief Read a string
std::string ReadString(const RecordData &Record, unsigned &Idx);
+ /// \brief Read a version tuple.
+ VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx);
+
CXXTemporary *ReadCXXTemporary(const RecordData &Record, unsigned &Idx);
/// \brief Reads attributes from the current stream position.
diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h
index 04ad93fa7c1ae..1a79b31d26b4a 100644
--- a/include/clang/Serialization/ASTWriter.h
+++ b/include/clang/Serialization/ASTWriter.h
@@ -56,6 +56,7 @@ class Sema;
class SourceManager;
class SwitchCase;
class TargetInfo;
+class VersionTuple;
/// \brief Writes an AST file containing the contents of a translation unit.
///
@@ -322,6 +323,7 @@ private:
void WriteHeaderSearch(HeaderSearch &HS, const char* isysroot);
void WritePreprocessorDetail(PreprocessingRecord &PPRec);
void WritePragmaDiagnosticMappings(const Diagnostic &Diag);
+ void WriteCXXBaseSpecifiersOffsets();
void WriteType(QualType T);
uint64_t WriteDeclContextLexicalBlock(ASTContext &Context, DeclContext *DC);
uint64_t WriteDeclContextVisibleBlock(ASTContext &Context, DeclContext *DC);
@@ -513,6 +515,9 @@ public:
/// \brief Add a string to the given record.
void AddString(llvm::StringRef Str, RecordDataImpl &Record);
+ /// \brief Add a version tuple to the given record
+ void AddVersionTuple(const VersionTuple &Version, RecordDataImpl &Record);
+
/// \brief Mark a declaration context as needing an update.
void AddUpdatedDeclContext(const DeclContext *DC) {
UpdatedDeclContexts.insert(DC);
@@ -581,6 +586,10 @@ public:
virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D);
virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
const ClassTemplateSpecializationDecl *D);
+ virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
+ const FunctionDecl *D);
+ virtual void CompletedImplicitDefinition(const FunctionDecl *D);
+ virtual void StaticDataMemberInstantiated(const VarDecl *D);
};
/// \brief AST and semantic-analysis consumer that generates a
diff --git a/include/clang/Serialization/ChainedIncludesSource.h b/include/clang/Serialization/ChainedIncludesSource.h
new file mode 100644
index 0000000000000..0c3e86faf414f
--- /dev/null
+++ b/include/clang/Serialization/ChainedIncludesSource.h
@@ -0,0 +1,76 @@
+//===- ChainedIncludesSource.h - Chained PCHs in Memory ---------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the ChainedIncludesSource class, which converts headers
+// to chained PCHs in memory, mainly used for testing.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_CLANG_SERIALIZATION_CHAINEDINCLUDESSOURCE_H
+#define LLVM_CLANG_SERIALIZATION_CHAINEDINCLUDESSOURCE_H
+
+#include "clang/Sema/ExternalSemaSource.h"
+#include <vector>
+
+namespace clang {
+ class CompilerInstance;
+
+class ChainedIncludesSource : public ExternalSemaSource {
+public:
+ virtual ~ChainedIncludesSource();
+
+ static ChainedIncludesSource *create(CompilerInstance &CI);
+
+private:
+ ExternalSemaSource &getFinalReader() const { return *FinalReader; }
+
+ std::vector<CompilerInstance *> CIs;
+ llvm::OwningPtr<ExternalSemaSource> FinalReader;
+
+
+protected:
+
+//===----------------------------------------------------------------------===//
+// ExternalASTSource interface.
+//===----------------------------------------------------------------------===//
+
+ virtual Decl *GetExternalDecl(uint32_t ID);
+ virtual Selector GetExternalSelector(uint32_t ID);
+ virtual uint32_t GetNumExternalSelectors();
+ virtual Stmt *GetExternalDeclStmt(uint64_t Offset);
+ virtual CXXBaseSpecifier *GetExternalCXXBaseSpecifiers(uint64_t Offset);
+ virtual DeclContextLookupResult
+ FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name);
+ virtual void MaterializeVisibleDecls(const DeclContext *DC);
+ virtual bool FindExternalLexicalDecls(const DeclContext *DC,
+ bool (*isKindWeWant)(Decl::Kind),
+ llvm::SmallVectorImpl<Decl*> &Result);
+ virtual void CompleteType(TagDecl *Tag);
+ virtual void CompleteType(ObjCInterfaceDecl *Class);
+ virtual void StartedDeserializing();
+ virtual void FinishedDeserializing();
+ virtual void StartTranslationUnit(ASTConsumer *Consumer);
+ virtual void PrintStats();
+
+ /// Return the amount of memory used by memory buffers, breaking down
+ /// by heap-backed versus mmap'ed memory.
+ virtual void getMemoryBufferSizes(MemoryBufferSizes &sizes) const;
+
+//===----------------------------------------------------------------------===//
+// ExternalSemaSource interface.
+//===----------------------------------------------------------------------===//
+
+ virtual void InitializeSema(Sema &S);
+ virtual void ForgetSema();
+ virtual std::pair<ObjCMethodList,ObjCMethodList> ReadMethodPool(Selector Sel);
+ virtual bool LookupUnqualified(LookupResult &R, Scope *S);
+};
+
+}
+
+#endif