summaryrefslogtreecommitdiffstats
path: root/include/clang/Serialization
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Serialization')
-rw-r--r--include/clang/Serialization/ASTBitCodes.h63
-rw-r--r--include/clang/Serialization/ASTReader.h36
-rw-r--r--include/clang/Serialization/ASTWriter.h13
3 files changed, 71 insertions, 41 deletions
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h
index f9bb892..dbe6e5a 100644
--- a/include/clang/Serialization/ASTBitCodes.h
+++ b/include/clang/Serialization/ASTBitCodes.h
@@ -207,7 +207,10 @@ namespace clang {
PREPROCESSOR_DETAIL_BLOCK_ID,
/// \brief The block containing the submodule structure.
- SUBMODULE_BLOCK_ID
+ SUBMODULE_BLOCK_ID,
+
+ /// \brief The block containing comments.
+ COMMENTS_BLOCK_ID
};
/// \brief Record types that occur within the AST block itself.
@@ -405,7 +408,7 @@ namespace clang {
/// sets.
CXX_BASE_SPECIFIER_OFFSETS = 37,
- /// \brief Record code for #pragma diagnostic mappings.
+ /// \brief Record code for \#pragma diagnostic mappings.
DIAG_PRAGMA_MAPPINGS = 38,
/// \brief Record code for special CUDA declarations.
@@ -417,7 +420,7 @@ namespace clang {
/// \brief The directory that the PCH was originally created in.
ORIGINAL_PCH_DIR = 41,
- /// \brief Record code for floating point #pragma options.
+ /// \brief Record code for floating point \#pragma options.
FP_PRAGMA_OPTIONS = 42,
/// \brief Record code for enabled OpenCL extensions.
@@ -441,7 +444,7 @@ namespace clang {
MODULE_OFFSET_MAP = 47,
/// \brief Record code for the source manager line table information,
- /// which stores information about #line directives.
+ /// which stores information about \#line directives.
SOURCE_MANAGER_LINE_TABLE = 48,
/// \brief Record code for map of Objective-C class definition IDs to the
@@ -469,7 +472,7 @@ namespace clang {
///
/// This array can only be interpreted properly using the Objective-C
/// categories map.
- OBJC_CATEGORIES
+ OBJC_CATEGORIES = 54
};
/// \brief Record types used within a source manager block.
@@ -500,8 +503,8 @@ namespace clang {
PP_MACRO_OBJECT_LIKE = 1,
/// \brief A function-like macro definition.
- /// [PP_MACRO_FUNCTION_LIKE, <ObjectLikeStuff>, IsC99Varargs, IsGNUVarars,
- /// NumArgs, ArgIdentInfoID* ]
+ /// [PP_MACRO_FUNCTION_LIKE, \<ObjectLikeStuff>, IsC99Varargs,
+ /// IsGNUVarars, NumArgs, ArgIdentInfoID* ]
PP_MACRO_FUNCTION_LIKE = 2,
/// \brief Describes one token.
@@ -545,7 +548,12 @@ namespace clang {
/// \brief Specifies a required feature.
SUBMODULE_REQUIRES = 7
};
-
+
+ /// \brief Record types used within a comments block.
+ enum CommentRecordTypes {
+ COMMENTS_RAW_COMMENT = 0
+ };
+
/// \defgroup ASTAST AST file AST constants
///
/// The constants in this group describe various components of the
@@ -557,7 +565,7 @@ namespace clang {
///
/// These type IDs correspond to predefined types in the AST
/// context, such as built-in types (int) and special place-holder
- /// types (the <overload> and <dependent> type markers). Such
+ /// types (the \<overload> and \<dependent> type markers). Such
/// types are never actually serialized, since they will be built
/// by the AST context when it is created.
enum PredefinedTypeIDs {
@@ -632,7 +640,9 @@ namespace clang {
/// \brief ARC's unbridged-cast placeholder type.
PREDEF_TYPE_ARC_UNBRIDGED_CAST = 34,
/// \brief The pseudo-object placeholder type.
- PREDEF_TYPE_PSEUDO_OBJECT = 35
+ PREDEF_TYPE_PSEUDO_OBJECT = 35,
+ /// \brief The __va_list_tag placeholder type.
+ PREDEF_TYPE_VA_LIST_TAG = 36
};
/// \brief The number of predefined type IDs that are reserved for
@@ -738,28 +748,26 @@ namespace clang {
/// The constants in this enumeration are indices into the
/// SPECIAL_TYPES record.
enum SpecialTypeIDs {
- /// \brief __builtin_va_list
- SPECIAL_TYPE_BUILTIN_VA_LIST = 0,
/// \brief CFConstantString type
- SPECIAL_TYPE_CF_CONSTANT_STRING = 1,
+ SPECIAL_TYPE_CF_CONSTANT_STRING = 0,
/// \brief C FILE typedef type
- SPECIAL_TYPE_FILE = 2,
+ SPECIAL_TYPE_FILE = 1,
/// \brief C jmp_buf typedef type
- SPECIAL_TYPE_JMP_BUF = 3,
+ SPECIAL_TYPE_JMP_BUF = 2,
/// \brief C sigjmp_buf typedef type
- SPECIAL_TYPE_SIGJMP_BUF = 4,
+ SPECIAL_TYPE_SIGJMP_BUF = 3,
/// \brief Objective-C "id" redefinition type
- SPECIAL_TYPE_OBJC_ID_REDEFINITION = 5,
+ SPECIAL_TYPE_OBJC_ID_REDEFINITION = 4,
/// \brief Objective-C "Class" redefinition type
- SPECIAL_TYPE_OBJC_CLASS_REDEFINITION = 6,
+ SPECIAL_TYPE_OBJC_CLASS_REDEFINITION = 5,
/// \brief Objective-C "SEL" redefinition type
- SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 7,
+ SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 6,
/// \brief C ucontext_t typedef type
- SPECIAL_TYPE_UCONTEXT_T = 8
+ SPECIAL_TYPE_UCONTEXT_T = 7
};
/// \brief The number of special type IDs.
- const unsigned NumSpecialTypeIDs = 9;
+ const unsigned NumSpecialTypeIDs = 8;
/// \brief Predefined declaration IDs.
///
@@ -793,14 +801,17 @@ namespace clang {
PREDEF_DECL_UNSIGNED_INT_128_ID = 7,
/// \brief The internal 'instancetype' typedef.
- PREDEF_DECL_OBJC_INSTANCETYPE_ID = 8
+ PREDEF_DECL_OBJC_INSTANCETYPE_ID = 8,
+
+ /// \brief The internal '__builtin_va_list' typedef.
+ PREDEF_DECL_BUILTIN_VA_LIST_ID = 9
};
/// \brief The number of declaration IDs that are predefined.
///
/// For more information about predefined declarations, see the
/// \c PredefinedDeclIDs type and the PREDEF_DECL_*_ID constants.
- const unsigned int NUM_PREDEF_DECL_IDS = 9;
+ const unsigned int NUM_PREDEF_DECL_IDS = 10;
/// \brief Record codes for each kind of declaration.
///
@@ -862,7 +873,7 @@ namespace clang {
/// in the order in which those declarations were added to the
/// declaration context. This data is used when iterating over
/// the contents of a DeclContext, e.g., via
- /// DeclContext::decls_begin()/DeclContext::decls_end().
+ /// DeclContext::decls_begin() and DeclContext::decls_end().
DECL_CONTEXT_LEXICAL,
/// \brief A record that stores the set of declarations that are
/// visible from a given DeclContext.
@@ -1066,7 +1077,7 @@ namespace clang {
/// \brief An ObjCStringLiteral record.
EXPR_OBJC_STRING_LITERAL,
- EXPR_OBJC_NUMERIC_LITERAL,
+ EXPR_OBJC_BOXED_EXPRESSION,
EXPR_OBJC_ARRAY_LITERAL,
EXPR_OBJC_DICTIONARY_LITERAL,
@@ -1089,7 +1100,7 @@ namespace clang {
EXPR_OBJC_MESSAGE_EXPR,
/// \brief An ObjCIsa Expr record.
EXPR_OBJC_ISA,
- /// \breif An ObjCIndirectCopyRestoreExpr record.
+ /// \brief An ObjCIndirectCopyRestoreExpr record.
EXPR_OBJC_INDIRECT_COPY_RESTORE,
/// \brief An ObjCForCollectionStmt record.
diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h
index a9d0fc3..f0b7275 100644
--- a/include/clang/Serialization/ASTReader.h
+++ b/include/clang/Serialization/ASTReader.h
@@ -199,6 +199,8 @@ class ASTReader
public ExternalSLocEntrySource
{
public:
+ typedef SmallVector<uint64_t, 64> RecordData;
+
enum ASTReadResult { Success, Failure, IgnorePCH };
/// \brief Types of AST files.
friend class PCHValidator;
@@ -454,7 +456,7 @@ private:
/// consumer eagerly.
SmallVector<uint64_t, 16> ExternalDefinitions;
- /// \brief The IDs of all tentative definitions stored in the the chain.
+ /// \brief The IDs of all tentative definitions stored in the chain.
///
/// Sema keeps track of all tentative definitions in a TU because it has to
/// complete them and pass them on to CodeGen. Thus, tentative definitions in
@@ -591,11 +593,14 @@ private:
/// indicates how many separate module file load operations have occurred.
unsigned CurrentGeneration;
+ typedef llvm::DenseMap<unsigned, SwitchCase *> SwitchCaseMapTy;
/// \brief Mapping from switch-case IDs in the chain to switch-case statements
///
/// Statements usually don't have IDs, but switch cases need them, so that the
/// switch statement can refer to them.
- std::map<unsigned, SwitchCase *> SwitchCaseStmts;
+ SwitchCaseMapTy SwitchCaseStmts;
+
+ SwitchCaseMapTy *CurrSwitchCaseStmts;
/// \brief The number of stat() calls that hit/missed the stat
/// cache.
@@ -798,7 +803,7 @@ private:
llvm::BitstreamCursor &SLocCursorForID(int ID);
SourceLocation getImportLocation(ModuleFile *F);
ASTReadResult ReadSubmoduleBlock(ModuleFile &F);
- bool ParseLanguageOptions(const SmallVectorImpl<uint64_t> &Record);
+ bool ParseLanguageOptions(const RecordData &Record);
struct RecordLocation {
RecordLocation(ModuleFile *M, uint64_t O)
@@ -821,19 +826,19 @@ private:
RecordLocation getLocalBitOffset(uint64_t GlobalOffset);
uint64_t getGlobalBitOffset(ModuleFile &M, uint32_t LocalOffset);
- /// \brief Returns the first preprocessed entity ID that ends after \arg BLoc.
+ /// \brief Returns the first preprocessed entity ID that ends after BLoc.
serialization::PreprocessedEntityID
findBeginPreprocessedEntity(SourceLocation BLoc) const;
- /// \brief Returns the first preprocessed entity ID that begins after \arg
- /// ELoc.
+ /// \brief Returns the first preprocessed entity ID that begins after ELoc.
serialization::PreprocessedEntityID
findEndPreprocessedEntity(SourceLocation ELoc) const;
- /// \brief \arg SLocMapI points at a chunk of a module that contains no
- /// preprocessed entities or the entities it contains are not the ones we are
- /// looking for. Find the next module that contains entities and return the ID
+ /// \brief Find the next module that contains entities and return the ID
/// of the first entry.
+ /// \arg SLocMapI points at a chunk of a module that contains no
+ /// preprocessed entities or the entities it contains are not the
+ /// ones we are looking for.
serialization::PreprocessedEntityID
findNextPreprocessedEntity(
GlobalSLocOffsetMapType::const_iterator SLocMapI) const;
@@ -859,8 +864,6 @@ private:
ASTReader(const ASTReader&); // do not implement
ASTReader &operator=(const ASTReader &); // do not implement
public:
- typedef SmallVector<uint64_t, 64> RecordData;
-
/// \brief Load the AST file and validate its contents against the given
/// Preprocessor.
///
@@ -907,8 +910,8 @@ public:
///
/// \param Mod The module whose names should be made visible.
///
- /// \param Visibility The level of visibility to give the names in the module.
- /// Visibility can only be increased over time.
+ /// \param NameVisibility The level of visibility to give the names in the
+ /// module. Visibility can only be increased over time.
void makeModuleVisible(Module *Mod,
Module::NameVisibilityKind NameVisibility);
@@ -1498,6 +1501,13 @@ public:
SwitchCase *getSwitchCaseWithID(unsigned ID);
void ClearSwitchCaseIDs();
+
+ /// \brief Cursors for comments blocks.
+ SmallVector<std::pair<llvm::BitstreamCursor,
+ serialization::ModuleFile *>, 8> CommentsCursors;
+
+ /// \brief Loads comments ranges.
+ void ReadComments();
};
/// \brief Helper class that saves the current stream position and
diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h
index e693f17..d038d58 100644
--- a/include/clang/Serialization/ASTWriter.h
+++ b/include/clang/Serialization/ASTWriter.h
@@ -110,6 +110,10 @@ private:
/// serialization, rather than just queueing updates.
bool WritingAST;
+ /// \brief Indicates that we are done serializing the collection of decls
+ /// and types to emit.
+ bool DoneWritingDeclsAndTypes;
+
/// \brief Indicates that the AST contained compiler errors.
bool ASTHasCompilerErrors;
@@ -296,6 +300,10 @@ private:
/// it.
llvm::SmallPtrSet<const DeclContext *, 16> UpdatedDeclContexts;
+ /// \brief Keeps track of visible decls that were added in DeclContexts
+ /// coming from another AST file.
+ SmallVector<const Decl *, 16> UpdatingVisibleDecls;
+
typedef llvm::SmallPtrSet<const Decl *, 16> DeclsToRewriteTy;
/// \brief Decls that will be replaced in the current dependent AST file.
DeclsToRewriteTy DeclsToRewrite;
@@ -337,7 +345,7 @@ private:
SmallVector<Stmt *, 16> *CollectedStmts;
/// \brief Mapping from SwitchCase statements to IDs.
- std::map<SwitchCase *, unsigned> SwitchCaseIDs;
+ llvm::DenseMap<SwitchCase *, unsigned> SwitchCaseIDs;
/// \brief The number of statements written to the AST file.
unsigned NumStatements;
@@ -414,11 +422,12 @@ private:
uint64_t WriteDeclContextVisibleBlock(ASTContext &Context, DeclContext *DC);
void WriteTypeDeclOffsets();
void WriteFileDeclIDsMap();
+ void WriteComments();
void WriteSelectors(Sema &SemaRef);
void WriteReferencedSelectorsPool(Sema &SemaRef);
void WriteIdentifierTable(Preprocessor &PP, IdentifierResolver &IdResolver,
bool IsModule);
- void WriteAttributes(const AttrVec &Attrs, RecordDataImpl &Record);
+ void WriteAttributes(ArrayRef<const Attr*> Attrs, RecordDataImpl &Record);
void ResolveDeclUpdatesBlocks();
void WriteDeclUpdatesBlocks();
void WriteDeclReplacementsBlock();
OpenPOWER on IntegriCloud