Do the PCH->AST rename for ASTWriter's implementation parts.

llvm-svn: 111464
This commit is contained in:
Sebastian Redl 2010-08-18 23:56:27 +00:00
parent 55c0ad5772
commit 42a0f6a7f2
13 changed files with 292 additions and 293 deletions

View File

@ -334,7 +334,7 @@ public:
}
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
/// ValueDecl - Represent the declaration of a variable (in which case it is
@ -1228,7 +1228,7 @@ public:
/// set that function declaration to the actual declaration
/// containing the body (if there is one).
/// NOTE: For checking if there is a body, use hasBody() instead, to avoid
/// unnecessary PCH de-serialization of the body.
/// unnecessary AST de-serialization of the body.
Stmt *getBody(const FunctionDecl *&Definition) const;
virtual Stmt *getBody() const {
@ -1616,7 +1616,7 @@ public:
}
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
@ -1989,7 +1989,7 @@ public:
}
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
/// EnumDecl - Represents an enum. As an extension, we allow forward-declared

View File

@ -223,8 +223,7 @@ protected:
unsigned Access : 2;
friend class CXXClassMemberWrapper;
/// PCHLevel - the "level" of precompiled header/AST file from which this
/// declaration was built.
/// PCHLevel - the "level" of AST file from which this declaration was built.
unsigned PCHLevel : 2;
/// PCHChanged - if this declaration has changed since being deserialized
@ -398,10 +397,10 @@ public:
}
/// \brief Query whether this declaration was changed in a significant way
/// since being loaded from a PCH file.
/// since being loaded from an AST file.
///
/// In an epic violation of layering, what is "significant" is entirely
/// up to the PCH system, but implemented in AST and Sema.
/// up to the serialization system, but implemented in AST and Sema.
bool isChangedSinceDeserialization() const { return PCHChanged; }
/// \brief Mark this declaration as having changed since deserialization, or

View File

@ -1058,7 +1058,7 @@ public:
}
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
/// CXXMethodDecl - Represents a static or instance method of a
@ -1518,7 +1518,7 @@ public:
static bool classofKind(Kind K) { return K == CXXConstructor; }
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
/// CXXDestructorDecl - Represents a C++ destructor within a
@ -1583,7 +1583,7 @@ public:
static bool classofKind(Kind K) { return K == CXXDestructor; }
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
/// CXXConversionDecl - Represents a C++ conversion function within a
@ -1640,7 +1640,7 @@ public:
static bool classofKind(Kind K) { return K == CXXConversion; }
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
/// LinkageSpecDecl - This represents a linkage specification. For example:
@ -2088,7 +2088,7 @@ public:
static bool classofKind(Kind K) { return K == Using; }
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
/// UnresolvedUsingValueDecl - Represents a dependent using

View File

@ -93,7 +93,7 @@ public:
static bool classofKind(Kind K) { return K == Decl::Friend; }
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
/// An iterator over the friend declarations of a class.

View File

@ -1239,7 +1239,7 @@ public:
static bool classofKind(Kind K) { return K == ObjCImplementation; }
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,

View File

@ -686,7 +686,7 @@ public:
}
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
template <class decl_type>
@ -866,7 +866,7 @@ public:
static bool classofKind(Kind K) { return K == FunctionTemplate; }
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
//===----------------------------------------------------------------------===//
@ -1145,7 +1145,7 @@ public:
static bool classofKind(Kind K) { return K == TemplateTemplateParm; }
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
/// \brief Represents a class template specialization, which refers to
@ -1788,7 +1788,7 @@ public:
static bool classofKind(Kind K) { return K == ClassTemplate; }
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
/// Declaration of a friend template. For example:

View File

@ -700,7 +700,7 @@ public:
virtual child_iterator child_end();
friend class PCHStmtReader;
friend class PCHStmtWriter;
friend class ASTStmtWriter;
};
/// PredefinedExpr - [C99 6.4.2.2] - A predefined identifier such as __func__.
@ -3349,7 +3349,7 @@ public:
virtual child_iterator child_end();
friend class PCHStmtReader;
friend class PCHStmtWriter;
friend class ASTStmtWriter;
};

View File

@ -560,7 +560,7 @@ public:
virtual child_iterator child_end();
friend class PCHStmtReader;
friend class PCHStmtWriter;
friend class ASTStmtWriter;
};
/// CXXTemporary - Represents a C++ temporary.

View File

@ -179,7 +179,7 @@ public:
redecl_iterator redecls_end() const { return redecl_iterator(); }
friend class PCHDeclReader;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
};
}

View File

@ -7,9 +7,8 @@
//
//===----------------------------------------------------------------------===//
//
// This file defines the ASTWriter class, which writes a precompiled
// header containing a serialized representation of a translation
// unit.
// This file defines the ASTWriter class, which writes an AST file
// containing a serialized representation of a translation unit.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_FRONTEND_PCH_WRITER_H
@ -79,7 +78,7 @@ class ASTWriter : public PCHDeserializationListener {
public:
typedef llvm::SmallVector<uint64_t, 64> RecordData;
friend class PCHDeclWriter;
friend class ASTDeclWriter;
private:
/// \brief The bitstream writer used to emit this precompiled header.
llvm::BitstreamWriter &Stream;
@ -87,7 +86,7 @@ private:
/// \brief The reader of existing PCH files, if we're chaining.
PCHReader *Chain;
/// \brief Stores a declaration or a type to be written to the PCH file.
/// \brief Stores a declaration or a type to be written to the AST file.
class DeclOrType {
public:
DeclOrType(Decl *D) : Stored(D), IsType(false) { }
@ -209,9 +208,9 @@ private:
/// definitions.
///
/// We keep track of external definitions (as well as tentative
/// definitions) as we are emitting declarations to the PCH
/// file. The PCH file contains a separate record for these external
/// definitions, which are provided to the AST consumer by the PCH
/// definitions) as we are emitting declarations to the AST
/// file. The AST file contains a separate record for these external
/// definitions, which are provided to the AST consumer by the AST
/// reader. This is behavior is required to properly cope with,
/// e.g., tentative variable definitions that occur within
/// headers. The declarations themselves are stored as declaration
@ -219,14 +218,15 @@ private:
/// record.
llvm::SmallVector<uint64_t, 16> ExternalDefinitions;
/// \brief Namespaces that have received extensions since their PCH form.
/// \brief Namespaces that have received extensions since their serialized
/// form.
///
/// Basically, when we're chaining and encountering a namespace, we check if
/// its primary namespace comes from the chain. If it does, we add the primary
/// to this set, so that we can write out lexical content updates for it.
llvm::SmallPtrSet<const NamespaceDecl *, 16> UpdatedNamespaces;
/// \brief Decls that have been replaced in the current dependent PCH.
/// \brief Decls that have been replaced in the current dependent AST file.
///
/// When a decl changes fundamentally after being deserialized (this shouldn't
/// happen, but the ObjC AST nodes are designed this way), it will be
@ -248,17 +248,17 @@ private:
/// \brief Mapping from LabelStmt statements to IDs.
std::map<LabelStmt *, unsigned> LabelIDs;
/// \brief The number of statements written to the PCH file.
/// \brief The number of statements written to the AST file.
unsigned NumStatements;
/// \brief The number of macros written to the PCH file.
/// \brief The number of macros written to the AST file.
unsigned NumMacros;
/// \brief The number of lexical declcontexts written to the PCH
/// \brief The number of lexical declcontexts written to the AST
/// file.
unsigned NumLexicalDeclContexts;
/// \brief The number of visible declcontexts written to the PCH
/// \brief The number of visible declcontexts written to the AST
/// file.
unsigned NumVisibleDeclContexts;

View File

@ -54,7 +54,7 @@ const T *data(const std::vector<T, Allocator> &v) {
//===----------------------------------------------------------------------===//
namespace {
class PCHTypeWriter {
class ASTTypeWriter {
ASTWriter &Writer;
ASTWriter::RecordData &Record;
@ -62,7 +62,7 @@ namespace {
/// \brief Type code that corresponds to the record generated.
pch::TypeCode Code;
PCHTypeWriter(ASTWriter &Writer, ASTWriter::RecordData &Record)
ASTTypeWriter(ASTWriter &Writer, ASTWriter::RecordData &Record)
: Writer(Writer), Record(Record), Code(pch::TYPE_EXT_QUAL) { }
void VisitArrayType(const ArrayType *T);
@ -75,59 +75,59 @@ namespace {
};
}
void PCHTypeWriter::VisitBuiltinType(const BuiltinType *T) {
void ASTTypeWriter::VisitBuiltinType(const BuiltinType *T) {
assert(false && "Built-in types are never serialized");
}
void PCHTypeWriter::VisitComplexType(const ComplexType *T) {
void ASTTypeWriter::VisitComplexType(const ComplexType *T) {
Writer.AddTypeRef(T->getElementType(), Record);
Code = pch::TYPE_COMPLEX;
}
void PCHTypeWriter::VisitPointerType(const PointerType *T) {
void ASTTypeWriter::VisitPointerType(const PointerType *T) {
Writer.AddTypeRef(T->getPointeeType(), Record);
Code = pch::TYPE_POINTER;
}
void PCHTypeWriter::VisitBlockPointerType(const BlockPointerType *T) {
void ASTTypeWriter::VisitBlockPointerType(const BlockPointerType *T) {
Writer.AddTypeRef(T->getPointeeType(), Record);
Code = pch::TYPE_BLOCK_POINTER;
}
void PCHTypeWriter::VisitLValueReferenceType(const LValueReferenceType *T) {
void ASTTypeWriter::VisitLValueReferenceType(const LValueReferenceType *T) {
Writer.AddTypeRef(T->getPointeeType(), Record);
Code = pch::TYPE_LVALUE_REFERENCE;
}
void PCHTypeWriter::VisitRValueReferenceType(const RValueReferenceType *T) {
void ASTTypeWriter::VisitRValueReferenceType(const RValueReferenceType *T) {
Writer.AddTypeRef(T->getPointeeType(), Record);
Code = pch::TYPE_RVALUE_REFERENCE;
}
void PCHTypeWriter::VisitMemberPointerType(const MemberPointerType *T) {
void ASTTypeWriter::VisitMemberPointerType(const MemberPointerType *T) {
Writer.AddTypeRef(T->getPointeeType(), Record);
Writer.AddTypeRef(QualType(T->getClass(), 0), Record);
Code = pch::TYPE_MEMBER_POINTER;
}
void PCHTypeWriter::VisitArrayType(const ArrayType *T) {
void ASTTypeWriter::VisitArrayType(const ArrayType *T) {
Writer.AddTypeRef(T->getElementType(), Record);
Record.push_back(T->getSizeModifier()); // FIXME: stable values
Record.push_back(T->getIndexTypeCVRQualifiers()); // FIXME: stable values
}
void PCHTypeWriter::VisitConstantArrayType(const ConstantArrayType *T) {
void ASTTypeWriter::VisitConstantArrayType(const ConstantArrayType *T) {
VisitArrayType(T);
Writer.AddAPInt(T->getSize(), Record);
Code = pch::TYPE_CONSTANT_ARRAY;
}
void PCHTypeWriter::VisitIncompleteArrayType(const IncompleteArrayType *T) {
void ASTTypeWriter::VisitIncompleteArrayType(const IncompleteArrayType *T) {
VisitArrayType(T);
Code = pch::TYPE_INCOMPLETE_ARRAY;
}
void PCHTypeWriter::VisitVariableArrayType(const VariableArrayType *T) {
void ASTTypeWriter::VisitVariableArrayType(const VariableArrayType *T) {
VisitArrayType(T);
Writer.AddSourceLocation(T->getLBracketLoc(), Record);
Writer.AddSourceLocation(T->getRBracketLoc(), Record);
@ -135,19 +135,19 @@ void PCHTypeWriter::VisitVariableArrayType(const VariableArrayType *T) {
Code = pch::TYPE_VARIABLE_ARRAY;
}
void PCHTypeWriter::VisitVectorType(const VectorType *T) {
void ASTTypeWriter::VisitVectorType(const VectorType *T) {
Writer.AddTypeRef(T->getElementType(), Record);
Record.push_back(T->getNumElements());
Record.push_back(T->getAltiVecSpecific());
Code = pch::TYPE_VECTOR;
}
void PCHTypeWriter::VisitExtVectorType(const ExtVectorType *T) {
void ASTTypeWriter::VisitExtVectorType(const ExtVectorType *T) {
VisitVectorType(T);
Code = pch::TYPE_EXT_VECTOR;
}
void PCHTypeWriter::VisitFunctionType(const FunctionType *T) {
void ASTTypeWriter::VisitFunctionType(const FunctionType *T) {
Writer.AddTypeRef(T->getResultType(), Record);
FunctionType::ExtInfo C = T->getExtInfo();
Record.push_back(C.getNoReturn());
@ -156,12 +156,12 @@ void PCHTypeWriter::VisitFunctionType(const FunctionType *T) {
Record.push_back(C.getCC());
}
void PCHTypeWriter::VisitFunctionNoProtoType(const FunctionNoProtoType *T) {
void ASTTypeWriter::VisitFunctionNoProtoType(const FunctionNoProtoType *T) {
VisitFunctionType(T);
Code = pch::TYPE_FUNCTION_NO_PROTO;
}
void PCHTypeWriter::VisitFunctionProtoType(const FunctionProtoType *T) {
void ASTTypeWriter::VisitFunctionProtoType(const FunctionProtoType *T) {
VisitFunctionType(T);
Record.push_back(T->getNumArgs());
for (unsigned I = 0, N = T->getNumArgs(); I != N; ++I)
@ -176,52 +176,52 @@ void PCHTypeWriter::VisitFunctionProtoType(const FunctionProtoType *T) {
Code = pch::TYPE_FUNCTION_PROTO;
}
void PCHTypeWriter::VisitUnresolvedUsingType(const UnresolvedUsingType *T) {
void ASTTypeWriter::VisitUnresolvedUsingType(const UnresolvedUsingType *T) {
Writer.AddDeclRef(T->getDecl(), Record);
Code = pch::TYPE_UNRESOLVED_USING;
}
void PCHTypeWriter::VisitTypedefType(const TypedefType *T) {
void ASTTypeWriter::VisitTypedefType(const TypedefType *T) {
Writer.AddDeclRef(T->getDecl(), Record);
assert(!T->isCanonicalUnqualified() && "Invalid typedef ?");
Writer.AddTypeRef(T->getCanonicalTypeInternal(), Record);
Code = pch::TYPE_TYPEDEF;
}
void PCHTypeWriter::VisitTypeOfExprType(const TypeOfExprType *T) {
void ASTTypeWriter::VisitTypeOfExprType(const TypeOfExprType *T) {
Writer.AddStmt(T->getUnderlyingExpr());
Code = pch::TYPE_TYPEOF_EXPR;
}
void PCHTypeWriter::VisitTypeOfType(const TypeOfType *T) {
void ASTTypeWriter::VisitTypeOfType(const TypeOfType *T) {
Writer.AddTypeRef(T->getUnderlyingType(), Record);
Code = pch::TYPE_TYPEOF;
}
void PCHTypeWriter::VisitDecltypeType(const DecltypeType *T) {
void ASTTypeWriter::VisitDecltypeType(const DecltypeType *T) {
Writer.AddStmt(T->getUnderlyingExpr());
Code = pch::TYPE_DECLTYPE;
}
void PCHTypeWriter::VisitTagType(const TagType *T) {
void ASTTypeWriter::VisitTagType(const TagType *T) {
Record.push_back(T->isDependentType());
Writer.AddDeclRef(T->getDecl(), Record);
assert(!T->isBeingDefined() &&
"Cannot serialize in the middle of a type definition");
}
void PCHTypeWriter::VisitRecordType(const RecordType *T) {
void ASTTypeWriter::VisitRecordType(const RecordType *T) {
VisitTagType(T);
Code = pch::TYPE_RECORD;
}
void PCHTypeWriter::VisitEnumType(const EnumType *T) {
void ASTTypeWriter::VisitEnumType(const EnumType *T) {
VisitTagType(T);
Code = pch::TYPE_ENUM;
}
void
PCHTypeWriter::VisitSubstTemplateTypeParmType(
ASTTypeWriter::VisitSubstTemplateTypeParmType(
const SubstTemplateTypeParmType *T) {
Writer.AddTypeRef(QualType(T->getReplacedParameter(), 0), Record);
Writer.AddTypeRef(T->getReplacementType(), Record);
@ -229,7 +229,7 @@ PCHTypeWriter::VisitSubstTemplateTypeParmType(
}
void
PCHTypeWriter::VisitTemplateSpecializationType(
ASTTypeWriter::VisitTemplateSpecializationType(
const TemplateSpecializationType *T) {
Record.push_back(T->isDependentType());
Writer.AddTemplateName(T->getTemplateName(), Record);
@ -244,7 +244,7 @@ PCHTypeWriter::VisitTemplateSpecializationType(
}
void
PCHTypeWriter::VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
ASTTypeWriter::VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
VisitArrayType(T);
Writer.AddStmt(T->getSizeExpr());
Writer.AddSourceRange(T->getBracketsRange(), Record);
@ -252,14 +252,14 @@ PCHTypeWriter::VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
}
void
PCHTypeWriter::VisitDependentSizedExtVectorType(
ASTTypeWriter::VisitDependentSizedExtVectorType(
const DependentSizedExtVectorType *T) {
// FIXME: Serialize this type (C++ only)
assert(false && "Cannot serialize dependent sized extended vector types");
}
void
PCHTypeWriter::VisitTemplateTypeParmType(const TemplateTypeParmType *T) {
ASTTypeWriter::VisitTemplateTypeParmType(const TemplateTypeParmType *T) {
Record.push_back(T->getDepth());
Record.push_back(T->getIndex());
Record.push_back(T->isParameterPack());
@ -268,7 +268,7 @@ PCHTypeWriter::VisitTemplateTypeParmType(const TemplateTypeParmType *T) {
}
void
PCHTypeWriter::VisitDependentNameType(const DependentNameType *T) {
ASTTypeWriter::VisitDependentNameType(const DependentNameType *T) {
Record.push_back(T->getKeyword());
Writer.AddNestedNameSpecifier(T->getQualifier(), Record);
Writer.AddIdentifierRef(T->getIdentifier(), Record);
@ -279,7 +279,7 @@ PCHTypeWriter::VisitDependentNameType(const DependentNameType *T) {
}
void
PCHTypeWriter::VisitDependentTemplateSpecializationType(
ASTTypeWriter::VisitDependentTemplateSpecializationType(
const DependentTemplateSpecializationType *T) {
Record.push_back(T->getKeyword());
Writer.AddNestedNameSpecifier(T->getQualifier(), Record);
@ -291,25 +291,25 @@ PCHTypeWriter::VisitDependentTemplateSpecializationType(
Code = pch::TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION;
}
void PCHTypeWriter::VisitElaboratedType(const ElaboratedType *T) {
void ASTTypeWriter::VisitElaboratedType(const ElaboratedType *T) {
Record.push_back(T->getKeyword());
Writer.AddNestedNameSpecifier(T->getQualifier(), Record);
Writer.AddTypeRef(T->getNamedType(), Record);
Code = pch::TYPE_ELABORATED;
}
void PCHTypeWriter::VisitInjectedClassNameType(const InjectedClassNameType *T) {
void ASTTypeWriter::VisitInjectedClassNameType(const InjectedClassNameType *T) {
Writer.AddDeclRef(T->getDecl(), Record);
Writer.AddTypeRef(T->getInjectedSpecializationType(), Record);
Code = pch::TYPE_INJECTED_CLASS_NAME;
}
void PCHTypeWriter::VisitObjCInterfaceType(const ObjCInterfaceType *T) {
void ASTTypeWriter::VisitObjCInterfaceType(const ObjCInterfaceType *T) {
Writer.AddDeclRef(T->getDecl(), Record);
Code = pch::TYPE_OBJC_INTERFACE;
}
void PCHTypeWriter::VisitObjCObjectType(const ObjCObjectType *T) {
void ASTTypeWriter::VisitObjCObjectType(const ObjCObjectType *T) {
Writer.AddTypeRef(T->getBaseType(), Record);
Record.push_back(T->getNumProtocols());
for (ObjCObjectType::qual_iterator I = T->qual_begin(),
@ -319,7 +319,7 @@ void PCHTypeWriter::VisitObjCObjectType(const ObjCObjectType *T) {
}
void
PCHTypeWriter::VisitObjCObjectPointerType(const ObjCObjectPointerType *T) {
ASTTypeWriter::VisitObjCObjectPointerType(const ObjCObjectPointerType *T) {
Writer.AddTypeRef(T->getPointeeType(), Record);
Code = pch::TYPE_OBJC_OBJECT_POINTER;
}
@ -613,7 +613,7 @@ void ASTWriter::WriteBlockInfoBlock() {
#define BLOCK(X) EmitBlockID(pch::X ## _ID, #X, Stream, Record)
#define RECORD(X) EmitRecordID(pch::X, #X, Stream, Record)
// PCH Top-Level Block.
// AST Top-Level Block.
BLOCK(PCH_BLOCK);
RECORD(ORIGINAL_FILE_NAME);
RECORD(TYPE_OFFSET);
@ -751,7 +751,7 @@ adjustFilenameForRelocatablePCH(const char *Filename, const char *isysroot) {
return Filename + Pos;
}
/// \brief Write the PCH metadata (e.g., i686-apple-darwin9).
/// \brief Write the AST metadata (e.g., i686-apple-darwin9).
void ASTWriter::WriteMetadata(ASTContext &Context, const char *isysroot) {
using namespace llvm;
@ -760,8 +760,8 @@ void ASTWriter::WriteMetadata(ASTContext &Context, const char *isysroot) {
BitCodeAbbrev *MetaAbbrev = new BitCodeAbbrev();
MetaAbbrev->Add(BitCodeAbbrevOp(
Chain ? pch::CHAINED_METADATA : pch::METADATA));
MetaAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // PCH major
MetaAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // PCH minor
MetaAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // AST major
MetaAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // AST minor
MetaAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // Clang major
MetaAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // Clang minor
MetaAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Relocatable
@ -892,7 +892,7 @@ void ASTWriter::WriteLanguageOptions(const LangOptions &LangOpts) {
namespace {
// Trait used for the on-disk hash table of stat cache results.
class PCHStatCacheTrait {
class ASTStatCacheTrait {
public:
typedef const char * key_type;
typedef key_type key_type_ref;
@ -941,11 +941,11 @@ public:
};
} // end anonymous namespace
/// \brief Write the stat() system call cache to the PCH file.
/// \brief Write the stat() system call cache to the AST file.
void ASTWriter::WriteStatCache(MemorizeStatCalls &StatCalls) {
// Build the on-disk hash table containing information about every
// stat() call.
OnDiskChainedHashTableGenerator<PCHStatCacheTrait> Generator;
OnDiskChainedHashTableGenerator<ASTStatCacheTrait> Generator;
unsigned NumStatEntries = 0;
for (MemorizeStatCalls::iterator Stat = StatCalls.begin(),
StatEnd = StatCalls.end();
@ -1211,7 +1211,7 @@ void ASTWriter::WriteSourceManagerBlock(SourceManager &SourceMgr,
if (SLocEntryOffsets.empty())
return;
// Write the source-location offsets table into the PCH block. This
// Write the source-location offsets table into the AST block. This
// table is used for lazily loading source-location information.
using namespace llvm;
BitCodeAbbrev *Abbrev = new BitCodeAbbrev();
@ -1229,7 +1229,7 @@ void ASTWriter::WriteSourceManagerBlock(SourceManager &SourceMgr,
(const char *)data(SLocEntryOffsets),
SLocEntryOffsets.size()*sizeof(SLocEntryOffsets[0]));
// Write the source location entry preloads array, telling the PCH
// Write the source location entry preloads array, telling the AST
// reader which source locations entries it should load eagerly.
Stream.EmitRecord(pch::SOURCE_LOCATION_PRELOADS, PreloadSLocs);
}
@ -1254,7 +1254,7 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) {
// Enter the preprocessor block.
Stream.EnterSubblock(pch::PREPROCESSOR_BLOCK_ID, 2);
// If the PCH file contains __DATE__ or __TIME__ emit a warning about this.
// If the AST file contains __DATE__ or __TIME__ emit a warning about this.
// FIXME: use diagnostics subsystem for localization etc.
if (PP.SawDateOrTime())
fprintf(stderr, "warning: precompiled header used __DATE__ or __TIME__.\n");
@ -1268,9 +1268,9 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) {
// order so that output is reproducible.
MacroInfo *MI = I->second;
// Don't emit builtin macros like __LINE__ to the PCH file unless they have
// Don't emit builtin macros like __LINE__ to the AST file unless they have
// been redefined by the header (in which case they are not isBuiltinMacro).
// Also skip macros from a PCH file if we're chaining.
// Also skip macros from a AST file if we're chaining.
if (MI->isBuiltinMacro() || (Chain && MI->isFromPCH()))
continue;
@ -1393,7 +1393,7 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) {
// Type Serialization
//===----------------------------------------------------------------------===//
/// \brief Write the representation of a type to the PCH stream.
/// \brief Write the representation of a type to the AST stream.
void ASTWriter::WriteType(QualType T) {
pch::TypeID &ID = TypeIDs[T];
if (ID == 0) // we haven't seen this type before.
@ -1411,7 +1411,7 @@ void ASTWriter::WriteType(QualType T) {
RecordData Record;
// Emit the type's representation.
PCHTypeWriter W(*this, Record);
ASTTypeWriter W(*this, Record);
if (T.hasLocalNonFastQualifiers()) {
Qualifiers Qs = T.getLocalQualifiers();
@ -1554,7 +1554,7 @@ void ASTWriter::WriteTypeDeclOffsets() {
namespace {
// Trait used for the on-disk hash table used in the method pool.
class PCHMethodPoolTrait {
class ASTMethodPoolTrait {
ASTWriter &Writer;
public:
@ -1567,7 +1567,7 @@ public:
};
typedef const data_type& data_type_ref;
explicit PCHMethodPoolTrait(ASTWriter &Writer) : Writer(Writer) { }
explicit ASTMethodPoolTrait(ASTWriter &Writer) : Writer(Writer) { }
static unsigned ComputeHash(Selector Sel) {
unsigned N = Sel.getNumArgs();
@ -1657,7 +1657,7 @@ void ASTWriter::WriteSelectors(Sema &SemaRef) {
unsigned NumTableEntries = 0;
// Create and write out the blob that contains selectors and the method pool.
{
OnDiskChainedHashTableGenerator<PCHMethodPoolTrait> Generator;
OnDiskChainedHashTableGenerator<ASTMethodPoolTrait> Generator;
// Create the on-disk hash table representation. We walk through every
// selector we've seen and look it up in the method pool.
@ -1667,7 +1667,7 @@ void ASTWriter::WriteSelectors(Sema &SemaRef) {
I != E; ++I) {
Selector S = I->first;
Sema::GlobalMethodPool::iterator F = SemaRef.MethodPool.find(S);
PCHMethodPoolTrait::data_type Data = {
ASTMethodPoolTrait::data_type Data = {
I->second,
ObjCMethodList(),
ObjCMethodList()
@ -1676,7 +1676,7 @@ void ASTWriter::WriteSelectors(Sema &SemaRef) {
Data.Instance = F->second.first;
Data.Factory = F->second.second;
}
// Only write this selector if it's not in an existing PCH or something
// Only write this selector if it's not in an existing AST or something
// changed.
if (Chain && I->second < FirstSelectorID) {
// Selector already exists. Did it change?
@ -1704,7 +1704,7 @@ void ASTWriter::WriteSelectors(Sema &SemaRef) {
llvm::SmallString<4096> MethodPool;
uint32_t BucketOffset;
{
PCHMethodPoolTrait Trait(*this);
ASTMethodPoolTrait Trait(*this);
llvm::raw_svector_ostream Out(MethodPool);
// Make sure that no bucket is at offset 0
clang::io::Emit32(Out, 0);
@ -1743,7 +1743,7 @@ void ASTWriter::WriteSelectors(Sema &SemaRef) {
}
}
/// \brief Write the selectors referenced in @selector expression into PCH file.
/// \brief Write the selectors referenced in @selector expression into AST file.
void ASTWriter::WriteReferencedSelectorsPool(Sema &SemaRef) {
using namespace llvm;
if (SemaRef.ReferencedSelectors.empty())
@ -1751,7 +1751,7 @@ void ASTWriter::WriteReferencedSelectorsPool(Sema &SemaRef) {
RecordData Record;
// Note: this writes out all references even for a dependent PCH. But it is
// Note: this writes out all references even for a dependent AST. But it is
// very tricky to fix, and given that @selector shouldn't really appear in
// headers, probably not worth it. It's not a correctness issue.
for (DenseMap<Selector, SourceLocation>::iterator S =
@ -1770,7 +1770,7 @@ void ASTWriter::WriteReferencedSelectorsPool(Sema &SemaRef) {
//===----------------------------------------------------------------------===//
namespace {
class PCHIdentifierTableTrait {
class ASTIdentifierTableTrait {
ASTWriter &Writer;
Preprocessor &PP;
@ -1792,7 +1792,7 @@ public:
typedef pch::IdentID data_type;
typedef data_type data_type_ref;
PCHIdentifierTableTrait(ASTWriter &Writer, Preprocessor &PP)
ASTIdentifierTableTrait(ASTWriter &Writer, Preprocessor &PP)
: Writer(Writer), PP(PP) { }
static unsigned ComputeHash(const IdentifierInfo* II) {
@ -1870,7 +1870,7 @@ public:
};
} // end anonymous namespace
/// \brief Write the identifier table into the PCH file.
/// \brief Write the identifier table into the AST file.
///
/// The identifier table consists of a blob containing string data
/// (the actual identifiers themselves) and a separate "offsets" index
@ -1881,12 +1881,12 @@ void ASTWriter::WriteIdentifierTable(Preprocessor &PP) {
// Create and write out the blob that contains the identifier
// strings.
{
OnDiskChainedHashTableGenerator<PCHIdentifierTableTrait> Generator;
OnDiskChainedHashTableGenerator<ASTIdentifierTableTrait> Generator;
// Look for any identifiers that were named while processing the
// headers, but are otherwise not needed. We add these to the hash
// table to enable checking of the predefines buffer in the case
// where the user adds new macro definitions when building the PCH
// where the user adds new macro definitions when building the AST
// file.
for (IdentifierTable::iterator ID = PP.getIdentifierTable().begin(),
IDEnd = PP.getIdentifierTable().end();
@ -1908,7 +1908,7 @@ void ASTWriter::WriteIdentifierTable(Preprocessor &PP) {
llvm::SmallString<4096> IdentifierTable;
uint32_t BucketOffset;
{
PCHIdentifierTableTrait Trait(*this, PP);
ASTIdentifierTableTrait Trait(*this, PP);
llvm::raw_svector_ostream Out(IdentifierTable);
// Make sure that no bucket is at offset 0
clang::io::Emit32(Out, 0);
@ -1973,7 +1973,7 @@ void ASTWriter::AddString(const std::string &Str, RecordData &Record) {
/// within the identifier table.
void ASTWriter::SetIdentifierOffset(const IdentifierInfo *II, uint32_t Offset) {
pch::IdentID ID = IdentifierIDs[II];
// Only store offsets new to this PCH file. Other identifier names are looked
// Only store offsets new to this AST file. Other identifier names are looked
// up earlier in the chain and thus don't need an offset.
if (ID >= FirstIdentID)
IdentifierOffsets[ID - FirstIdentID] = Offset;
@ -2070,7 +2070,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls,
// declarations in this header file. Generally, this record will be
// empty.
RecordData LocallyScopedExternalDecls;
// FIXME: This is filling in the PCH file in densemap order which is
// FIXME: This is filling in the AST file in densemap order which is
// nondeterminstic!
for (llvm::DenseMap<DeclarationName, NamedDecl *>::iterator
TD = SemaRef.LocallyScopedExternalDecls.begin(),
@ -2117,7 +2117,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls,
AddDeclRef(SemaRef.getStdBadAlloc(), SemaDeclRefs);
}
// Write the remaining PCH contents.
// Write the remaining AST contents.
RecordData Record;
Stream.EnterSubblock(pch::PCH_BLOCK_ID, 5);
WriteMetadata(Context, isysroot);
@ -2305,7 +2305,7 @@ void ASTWriter::WriteASTChain(Sema &SemaRef, MemorizeStatCalls *StatCalls,
// declarations in this header file. Generally, this record will be
// empty.
RecordData LocallyScopedExternalDecls;
// FIXME: This is filling in the PCH file in densemap order which is
// FIXME: This is filling in the AST file in densemap order which is
// nondeterminstic!
for (llvm::DenseMap<DeclarationName, NamedDecl *>::iterator
TD = SemaRef.LocallyScopedExternalDecls.begin(),
@ -2381,7 +2381,7 @@ void ASTWriter::WriteASTChain(Sema &SemaRef, MemorizeStatCalls *StatCalls,
WriteTypeDeclOffsets();
/// Build a record containing first declarations from a chained PCH and the
/// most recent declarations in this PCH that they point to.
/// most recent declarations in this AST that they point to.
RecordData FirstLatestDeclIDs;
for (FirstLatestDeclMap::iterator
I = FirstLatestDecls.begin(), E = FirstLatestDecls.end(); I != E; ++I) {

View File

@ -26,7 +26,7 @@ using namespace clang;
//===----------------------------------------------------------------------===//
namespace clang {
class PCHDeclWriter : public DeclVisitor<PCHDeclWriter, void> {
class ASTDeclWriter : public DeclVisitor<ASTDeclWriter, void> {
ASTWriter &Writer;
ASTContext &Context;
@ -36,7 +36,7 @@ namespace clang {
pch::DeclCode Code;
unsigned AbbrevToUse;
PCHDeclWriter(ASTWriter &Writer, ASTContext &Context,
ASTDeclWriter(ASTWriter &Writer, ASTContext &Context,
ASTWriter::RecordData &Record)
: Writer(Writer), Context(Context), Record(Record) {
}
@ -114,12 +114,12 @@ namespace clang {
};
}
void PCHDeclWriter::Visit(Decl *D) {
DeclVisitor<PCHDeclWriter>::Visit(D);
void ASTDeclWriter::Visit(Decl *D) {
DeclVisitor<ASTDeclWriter>::Visit(D);
// Handle FunctionDecl's body here and write it after all other Stmts/Exprs
// have been written. We want it last because we will not read it back when
// retrieving it from the PCH, we'll just lazily set the offset.
// retrieving it from the AST, we'll just lazily set the offset.
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
Record.push_back(FD->isThisDeclarationADefinition());
if (FD->isThisDeclarationADefinition())
@ -127,7 +127,7 @@ void PCHDeclWriter::Visit(Decl *D) {
}
}
void PCHDeclWriter::VisitDecl(Decl *D) {
void ASTDeclWriter::VisitDecl(Decl *D) {
Writer.AddDeclRef(cast_or_null<Decl>(D->getDeclContext()), Record);
Writer.AddDeclRef(cast_or_null<Decl>(D->getLexicalDeclContext()), Record);
Writer.AddSourceLocation(D->getLocation(), Record);
@ -139,29 +139,29 @@ void PCHDeclWriter::VisitDecl(Decl *D) {
Record.push_back(D->getPCHLevel());
}
void PCHDeclWriter::VisitTranslationUnitDecl(TranslationUnitDecl *D) {
void ASTDeclWriter::VisitTranslationUnitDecl(TranslationUnitDecl *D) {
VisitDecl(D);
Writer.AddDeclRef(D->getAnonymousNamespace(), Record);
Code = pch::DECL_TRANSLATION_UNIT;
}
void PCHDeclWriter::VisitNamedDecl(NamedDecl *D) {
void ASTDeclWriter::VisitNamedDecl(NamedDecl *D) {
VisitDecl(D);
Writer.AddDeclarationName(D->getDeclName(), Record);
}
void PCHDeclWriter::VisitTypeDecl(TypeDecl *D) {
void ASTDeclWriter::VisitTypeDecl(TypeDecl *D) {
VisitNamedDecl(D);
Writer.AddTypeRef(QualType(D->getTypeForDecl(), 0), Record);
}
void PCHDeclWriter::VisitTypedefDecl(TypedefDecl *D) {
void ASTDeclWriter::VisitTypedefDecl(TypedefDecl *D) {
VisitTypeDecl(D);
Writer.AddTypeSourceInfo(D->getTypeSourceInfo(), Record);
Code = pch::DECL_TYPEDEF;
}
void PCHDeclWriter::VisitTagDecl(TagDecl *D) {
void ASTDeclWriter::VisitTagDecl(TagDecl *D) {
VisitTypeDecl(D);
Record.push_back(D->getIdentifierNamespace());
VisitRedeclarable(D);
@ -174,7 +174,7 @@ void PCHDeclWriter::VisitTagDecl(TagDecl *D) {
Writer.AddDeclRef(D->getTypedefForAnonDecl(), Record);
}
void PCHDeclWriter::VisitEnumDecl(EnumDecl *D) {
void ASTDeclWriter::VisitEnumDecl(EnumDecl *D) {
VisitTagDecl(D);
Writer.AddTypeRef(D->getIntegerType(), Record);
Writer.AddTypeRef(D->getPromotionType(), Record);
@ -184,7 +184,7 @@ void PCHDeclWriter::VisitEnumDecl(EnumDecl *D) {
Code = pch::DECL_ENUM;
}
void PCHDeclWriter::VisitRecordDecl(RecordDecl *D) {
void ASTDeclWriter::VisitRecordDecl(RecordDecl *D) {
VisitTagDecl(D);
Record.push_back(D->hasFlexibleArrayMember());
Record.push_back(D->isAnonymousStructOrUnion());
@ -192,12 +192,12 @@ void PCHDeclWriter::VisitRecordDecl(RecordDecl *D) {
Code = pch::DECL_RECORD;
}
void PCHDeclWriter::VisitValueDecl(ValueDecl *D) {
void ASTDeclWriter::VisitValueDecl(ValueDecl *D) {
VisitNamedDecl(D);
Writer.AddTypeRef(D->getType(), Record);
}
void PCHDeclWriter::VisitEnumConstantDecl(EnumConstantDecl *D) {
void ASTDeclWriter::VisitEnumConstantDecl(EnumConstantDecl *D) {
VisitValueDecl(D);
Record.push_back(D->getInitExpr()? 1 : 0);
if (D->getInitExpr())
@ -206,13 +206,13 @@ void PCHDeclWriter::VisitEnumConstantDecl(EnumConstantDecl *D) {
Code = pch::DECL_ENUM_CONSTANT;
}
void PCHDeclWriter::VisitDeclaratorDecl(DeclaratorDecl *D) {
void ASTDeclWriter::VisitDeclaratorDecl(DeclaratorDecl *D) {
VisitValueDecl(D);
Writer.AddTypeSourceInfo(D->getTypeSourceInfo(), Record);
// FIXME: write optional qualifier and its range.
}
void PCHDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
VisitDeclaratorDecl(D);
// FIXME: write DeclarationNameLoc.
@ -278,7 +278,7 @@ void PCHDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
}
}
// FunctionDecl's body is handled last at PCHWriterDecl::Visit,
// FunctionDecl's body is handled last at ASTWriterDecl::Visit,
// after everything else is written.
VisitRedeclarable(D);
@ -302,7 +302,7 @@ void PCHDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
Code = pch::DECL_FUNCTION;
}
void PCHDeclWriter::VisitObjCMethodDecl(ObjCMethodDecl *D) {
void ASTDeclWriter::VisitObjCMethodDecl(ObjCMethodDecl *D) {
VisitNamedDecl(D);
// FIXME: convert to LazyStmtPtr?
// Unlike C/C++, method bodies will never be in header files.
@ -333,13 +333,13 @@ void PCHDeclWriter::VisitObjCMethodDecl(ObjCMethodDecl *D) {
Code = pch::DECL_OBJC_METHOD;
}
void PCHDeclWriter::VisitObjCContainerDecl(ObjCContainerDecl *D) {
void ASTDeclWriter::VisitObjCContainerDecl(ObjCContainerDecl *D) {
VisitNamedDecl(D);
Writer.AddSourceRange(D->getAtEndRange(), Record);
// Abstract class (no need to define a stable pch::DECL code).
}
void PCHDeclWriter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {
void ASTDeclWriter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {
VisitObjCContainerDecl(D);
Writer.AddTypeRef(QualType(D->getTypeForDecl(), 0), Record);
Writer.AddDeclRef(D->getSuperClass(), Record);
@ -365,7 +365,7 @@ void PCHDeclWriter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {
Code = pch::DECL_OBJC_INTERFACE;
}
void PCHDeclWriter::VisitObjCIvarDecl(ObjCIvarDecl *D) {
void ASTDeclWriter::VisitObjCIvarDecl(ObjCIvarDecl *D) {
VisitFieldDecl(D);
// FIXME: stable encoding for @public/@private/@protected/@package
Record.push_back(D->getAccessControl());
@ -373,7 +373,7 @@ void PCHDeclWriter::VisitObjCIvarDecl(ObjCIvarDecl *D) {
Code = pch::DECL_OBJC_IVAR;
}
void PCHDeclWriter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {
void ASTDeclWriter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {
VisitObjCContainerDecl(D);
Record.push_back(D->isForwardDecl());
Writer.AddSourceLocation(D->getLocEnd(), Record);
@ -388,12 +388,12 @@ void PCHDeclWriter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {
Code = pch::DECL_OBJC_PROTOCOL;
}
void PCHDeclWriter::VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D) {
void ASTDeclWriter::VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D) {
VisitFieldDecl(D);
Code = pch::DECL_OBJC_AT_DEFS_FIELD;
}
void PCHDeclWriter::VisitObjCClassDecl(ObjCClassDecl *D) {
void ASTDeclWriter::VisitObjCClassDecl(ObjCClassDecl *D) {
VisitDecl(D);
Record.push_back(D->size());
for (ObjCClassDecl::iterator I = D->begin(), IEnd = D->end(); I != IEnd; ++I)
@ -403,7 +403,7 @@ void PCHDeclWriter::VisitObjCClassDecl(ObjCClassDecl *D) {
Code = pch::DECL_OBJC_CLASS;
}
void PCHDeclWriter::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *D) {
void ASTDeclWriter::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *D) {
VisitDecl(D);
Record.push_back(D->protocol_size());
for (ObjCForwardProtocolDecl::protocol_iterator
@ -416,7 +416,7 @@ void PCHDeclWriter::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *D) {
Code = pch::DECL_OBJC_FORWARD_PROTOCOL;
}
void PCHDeclWriter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) {
void ASTDeclWriter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) {
VisitObjCContainerDecl(D);
Writer.AddDeclRef(D->getClassInterface(), Record);
Record.push_back(D->protocol_size());
@ -433,13 +433,13 @@ void PCHDeclWriter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) {
Code = pch::DECL_OBJC_CATEGORY;
}
void PCHDeclWriter::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D) {
void ASTDeclWriter::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D) {
VisitNamedDecl(D);
Writer.AddDeclRef(D->getClassInterface(), Record);
Code = pch::DECL_OBJC_COMPATIBLE_ALIAS;
}
void PCHDeclWriter::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
void ASTDeclWriter::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
VisitNamedDecl(D);
Writer.AddSourceLocation(D->getAtLoc(), Record);
Writer.AddTypeSourceInfo(D->getTypeSourceInfo(), Record);
@ -456,19 +456,19 @@ void PCHDeclWriter::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
Code = pch::DECL_OBJC_PROPERTY;
}
void PCHDeclWriter::VisitObjCImplDecl(ObjCImplDecl *D) {
void ASTDeclWriter::VisitObjCImplDecl(ObjCImplDecl *D) {
VisitObjCContainerDecl(D);
Writer.AddDeclRef(D->getClassInterface(), Record);
// Abstract class (no need to define a stable pch::DECL code).
}
void PCHDeclWriter::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) {
void ASTDeclWriter::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) {
VisitObjCImplDecl(D);
Writer.AddIdentifierRef(D->getIdentifier(), Record);
Code = pch::DECL_OBJC_CATEGORY_IMPL;
}
void PCHDeclWriter::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
void ASTDeclWriter::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
VisitObjCImplDecl(D);
Writer.AddDeclRef(D->getSuperClass(), Record);
Writer.AddCXXBaseOrMemberInitializers(D->IvarInitializers,
@ -476,7 +476,7 @@ void PCHDeclWriter::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
Code = pch::DECL_OBJC_IMPLEMENTATION;
}
void PCHDeclWriter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
void ASTDeclWriter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
VisitDecl(D);
Writer.AddSourceLocation(D->getLocStart(), Record);
Writer.AddDeclRef(D->getPropertyDecl(), Record);
@ -486,7 +486,7 @@ void PCHDeclWriter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
Code = pch::DECL_OBJC_PROPERTY_IMPL;
}
void PCHDeclWriter::VisitFieldDecl(FieldDecl *D) {
void ASTDeclWriter::VisitFieldDecl(FieldDecl *D) {
VisitDeclaratorDecl(D);
Record.push_back(D->isMutable());
Record.push_back(D->getBitWidth()? 1 : 0);
@ -497,7 +497,7 @@ void PCHDeclWriter::VisitFieldDecl(FieldDecl *D) {
Code = pch::DECL_FIELD;
}
void PCHDeclWriter::VisitVarDecl(VarDecl *D) {
void ASTDeclWriter::VisitVarDecl(VarDecl *D) {
VisitDeclaratorDecl(D);
Record.push_back(D->getStorageClass()); // FIXME: stable encoding
Record.push_back(D->getStorageClassAsWritten());
@ -522,12 +522,12 @@ void PCHDeclWriter::VisitVarDecl(VarDecl *D) {
Code = pch::DECL_VAR;
}
void PCHDeclWriter::VisitImplicitParamDecl(ImplicitParamDecl *D) {
void ASTDeclWriter::VisitImplicitParamDecl(ImplicitParamDecl *D) {
VisitVarDecl(D);
Code = pch::DECL_IMPLICIT_PARAM;
}
void PCHDeclWriter::VisitParmVarDecl(ParmVarDecl *D) {
void ASTDeclWriter::VisitParmVarDecl(ParmVarDecl *D) {
VisitVarDecl(D);
Record.push_back(D->getObjCDeclQualifier()); // FIXME: stable encoding
Record.push_back(D->hasInheritedDefaultArg());
@ -564,13 +564,13 @@ void PCHDeclWriter::VisitParmVarDecl(ParmVarDecl *D) {
"PARM_VAR_DECL can't be static data member");
}
void PCHDeclWriter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) {
void ASTDeclWriter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) {
VisitDecl(D);
Writer.AddStmt(D->getAsmString());
Code = pch::DECL_FILE_SCOPE_ASM;
}
void PCHDeclWriter::VisitBlockDecl(BlockDecl *D) {
void ASTDeclWriter::VisitBlockDecl(BlockDecl *D) {
VisitDecl(D);
Writer.AddStmt(D->getBody());
Writer.AddTypeSourceInfo(D->getSignatureAsWritten(), Record);
@ -581,7 +581,7 @@ void PCHDeclWriter::VisitBlockDecl(BlockDecl *D) {
Code = pch::DECL_BLOCK;
}
void PCHDeclWriter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
void ASTDeclWriter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
VisitDecl(D);
// FIXME: It might be nice to serialize the brace locations for this
// declaration, which don't seem to be readily available in the AST.
@ -590,7 +590,7 @@ void PCHDeclWriter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
Code = pch::DECL_LINKAGE_SPEC;
}
void PCHDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) {
void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) {
VisitNamedDecl(D);
Writer.AddSourceLocation(D->getLBracLoc(), Record);
Writer.AddSourceLocation(D->getRBracLoc(), Record);
@ -610,7 +610,7 @@ void PCHDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) {
}
}
void PCHDeclWriter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
void ASTDeclWriter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
VisitNamedDecl(D);
Writer.AddSourceLocation(D->getAliasLoc(), Record);
Writer.AddSourceRange(D->getQualifierRange(), Record);
@ -620,7 +620,7 @@ void PCHDeclWriter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
Code = pch::DECL_NAMESPACE_ALIAS;
}
void PCHDeclWriter::VisitUsingDecl(UsingDecl *D) {
void ASTDeclWriter::VisitUsingDecl(UsingDecl *D) {
VisitNamedDecl(D);
Writer.AddSourceRange(D->getNestedNameRange(), Record);
Writer.AddSourceLocation(D->getUsingLocation(), Record);
@ -634,7 +634,7 @@ void PCHDeclWriter::VisitUsingDecl(UsingDecl *D) {
Code = pch::DECL_USING;
}
void PCHDeclWriter::VisitUsingShadowDecl(UsingShadowDecl *D) {
void ASTDeclWriter::VisitUsingShadowDecl(UsingShadowDecl *D) {
VisitNamedDecl(D);
Writer.AddDeclRef(D->getTargetDecl(), Record);
Writer.AddDeclRef(D->getUsingDecl(), Record);
@ -642,7 +642,7 @@ void PCHDeclWriter::VisitUsingShadowDecl(UsingShadowDecl *D) {
Code = pch::DECL_USING_SHADOW;
}
void PCHDeclWriter::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
void ASTDeclWriter::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
VisitNamedDecl(D);
Writer.AddSourceLocation(D->getNamespaceKeyLocation(), Record);
Writer.AddSourceRange(D->getQualifierRange(), Record);
@ -653,7 +653,7 @@ void PCHDeclWriter::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
Code = pch::DECL_USING_DIRECTIVE;
}
void PCHDeclWriter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
void ASTDeclWriter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
VisitValueDecl(D);
Writer.AddSourceRange(D->getTargetNestedNameRange(), Record);
Writer.AddSourceLocation(D->getUsingLoc(), Record);
@ -661,7 +661,7 @@ void PCHDeclWriter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
Code = pch::DECL_UNRESOLVED_USING_VALUE;
}
void PCHDeclWriter::VisitUnresolvedUsingTypenameDecl(
void ASTDeclWriter::VisitUnresolvedUsingTypenameDecl(
UnresolvedUsingTypenameDecl *D) {
VisitTypeDecl(D);
Writer.AddSourceRange(D->getTargetNestedNameRange(), Record);
@ -671,7 +671,7 @@ void PCHDeclWriter::VisitUnresolvedUsingTypenameDecl(
Code = pch::DECL_UNRESOLVED_USING_TYPENAME;
}
void PCHDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) {
void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) {
// See comments at PCHDeclReader::VisitCXXRecordDecl about why this happens
// before VisitRecordDecl.
enum { Data_NoDefData, Data_Owner, Data_NotOwner };
@ -750,7 +750,7 @@ void PCHDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) {
Code = pch::DECL_CXX_RECORD;
}
void PCHDeclWriter::VisitCXXMethodDecl(CXXMethodDecl *D) {
void ASTDeclWriter::VisitCXXMethodDecl(CXXMethodDecl *D) {
VisitFunctionDecl(D);
Record.push_back(D->size_overridden_methods());
for (CXXMethodDecl::method_iterator
@ -760,7 +760,7 @@ void PCHDeclWriter::VisitCXXMethodDecl(CXXMethodDecl *D) {
Code = pch::DECL_CXX_METHOD;
}
void PCHDeclWriter::VisitCXXConstructorDecl(CXXConstructorDecl *D) {
void ASTDeclWriter::VisitCXXConstructorDecl(CXXConstructorDecl *D) {
VisitCXXMethodDecl(D);
Record.push_back(D->IsExplicitSpecified);
@ -771,7 +771,7 @@ void PCHDeclWriter::VisitCXXConstructorDecl(CXXConstructorDecl *D) {
Code = pch::DECL_CXX_CONSTRUCTOR;
}
void PCHDeclWriter::VisitCXXDestructorDecl(CXXDestructorDecl *D) {
void ASTDeclWriter::VisitCXXDestructorDecl(CXXDestructorDecl *D) {
VisitCXXMethodDecl(D);
Record.push_back(D->ImplicitlyDefined);
@ -780,19 +780,19 @@ void PCHDeclWriter::VisitCXXDestructorDecl(CXXDestructorDecl *D) {
Code = pch::DECL_CXX_DESTRUCTOR;
}
void PCHDeclWriter::VisitCXXConversionDecl(CXXConversionDecl *D) {
void ASTDeclWriter::VisitCXXConversionDecl(CXXConversionDecl *D) {
VisitCXXMethodDecl(D);
Record.push_back(D->IsExplicitSpecified);
Code = pch::DECL_CXX_CONVERSION;
}
void PCHDeclWriter::VisitAccessSpecDecl(AccessSpecDecl *D) {
void ASTDeclWriter::VisitAccessSpecDecl(AccessSpecDecl *D) {
VisitDecl(D);
Writer.AddSourceLocation(D->getColonLoc(), Record);
Code = pch::DECL_ACCESS_SPEC;
}
void PCHDeclWriter::VisitFriendDecl(FriendDecl *D) {
void ASTDeclWriter::VisitFriendDecl(FriendDecl *D) {
VisitDecl(D);
Record.push_back(D->Friend.is<TypeSourceInfo*>());
if (D->Friend.is<TypeSourceInfo*>())
@ -804,7 +804,7 @@ void PCHDeclWriter::VisitFriendDecl(FriendDecl *D) {
Code = pch::DECL_FRIEND;
}
void PCHDeclWriter::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
void ASTDeclWriter::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
VisitDecl(D);
Record.push_back(D->getNumTemplateParameters());
for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)
@ -818,14 +818,14 @@ void PCHDeclWriter::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
Code = pch::DECL_FRIEND_TEMPLATE;
}
void PCHDeclWriter::VisitTemplateDecl(TemplateDecl *D) {
void ASTDeclWriter::VisitTemplateDecl(TemplateDecl *D) {
VisitNamedDecl(D);
Writer.AddDeclRef(D->getTemplatedDecl(), Record);
Writer.AddTemplateParameterList(D->getTemplateParameters(), Record);
}
void PCHDeclWriter::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {
void ASTDeclWriter::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {
VisitTemplateDecl(D);
Record.push_back(D->getIdentifierNamespace());
@ -844,7 +844,7 @@ void PCHDeclWriter::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {
assert(First != D);
// If this is a most recent redeclaration that is pointed to by a first decl
// in a chained PCH, keep track of the association with the map so we can
// update the first decl during PCH reading.
// update the first decl during AST reading.
if (First->getMostRecentDeclaration() == D &&
First->getPCHLevel() > D->getPCHLevel()) {
assert(Writer.FirstLatestDecls.find(First)==Writer.FirstLatestDecls.end()
@ -854,7 +854,7 @@ void PCHDeclWriter::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {
}
}
void PCHDeclWriter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
void ASTDeclWriter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
VisitRedeclarableTemplateDecl(D);
if (D->getPreviousDeclaration() == 0) {
@ -879,7 +879,7 @@ void PCHDeclWriter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
Code = pch::DECL_CLASS_TEMPLATE;
}
void PCHDeclWriter::VisitClassTemplateSpecializationDecl(
void ASTDeclWriter::VisitClassTemplateSpecializationDecl(
ClassTemplateSpecializationDecl *D) {
VisitCXXRecordDecl(D);
@ -913,7 +913,7 @@ void PCHDeclWriter::VisitClassTemplateSpecializationDecl(
Code = pch::DECL_CLASS_TEMPLATE_SPECIALIZATION;
}
void PCHDeclWriter::VisitClassTemplatePartialSpecializationDecl(
void ASTDeclWriter::VisitClassTemplatePartialSpecializationDecl(
ClassTemplatePartialSpecializationDecl *D) {
VisitClassTemplateSpecializationDecl(D);
@ -934,7 +934,7 @@ void PCHDeclWriter::VisitClassTemplatePartialSpecializationDecl(
Code = pch::DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION;
}
void PCHDeclWriter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
void ASTDeclWriter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
VisitRedeclarableTemplateDecl(D);
if (D->getPreviousDeclaration() == 0) {
@ -953,7 +953,7 @@ void PCHDeclWriter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
Code = pch::DECL_FUNCTION_TEMPLATE;
}
void PCHDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
VisitTypeDecl(D);
Record.push_back(D->wasDeclaredWithTypename());
@ -964,7 +964,7 @@ void PCHDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
Code = pch::DECL_TEMPLATE_TYPE_PARM;
}
void PCHDeclWriter::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {
void ASTDeclWriter::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {
VisitVarDecl(D);
// TemplateParmPosition.
Record.push_back(D->getDepth());
@ -978,7 +978,7 @@ void PCHDeclWriter::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {
Code = pch::DECL_NON_TYPE_TEMPLATE_PARM;
}
void PCHDeclWriter::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) {
void ASTDeclWriter::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) {
VisitTemplateDecl(D);
// TemplateParmPosition.
Record.push_back(D->getDepth());
@ -989,7 +989,7 @@ void PCHDeclWriter::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) {
Code = pch::DECL_TEMPLATE_TEMPLATE_PARM;
}
void PCHDeclWriter::VisitStaticAssertDecl(StaticAssertDecl *D) {
void ASTDeclWriter::VisitStaticAssertDecl(StaticAssertDecl *D) {
VisitDecl(D);
Writer.AddStmt(D->getAssertExpr());
Writer.AddStmt(D->getMessage());
@ -1007,14 +1007,14 @@ void PCHDeclWriter::VisitStaticAssertDecl(StaticAssertDecl *D) {
/// that there are no declarations visible from this context. Note
/// that this value will not be emitted for non-primary declaration
/// contexts.
void PCHDeclWriter::VisitDeclContext(DeclContext *DC, uint64_t LexicalOffset,
void ASTDeclWriter::VisitDeclContext(DeclContext *DC, uint64_t LexicalOffset,
uint64_t VisibleOffset) {
Record.push_back(LexicalOffset);
Record.push_back(VisibleOffset);
}
template <typename T>
void PCHDeclWriter::VisitRedeclarable(Redeclarable<T> *D) {
void ASTDeclWriter::VisitRedeclarable(Redeclarable<T> *D) {
enum { NoRedeclaration = 0, PointsToPrevious, PointsToLatest };
if (D->RedeclLink.getNext() == D) {
Record.push_back(NoRedeclaration);
@ -1028,7 +1028,7 @@ void PCHDeclWriter::VisitRedeclarable(Redeclarable<T> *D) {
T *ThisDecl = static_cast<T*>(D);
// If this is a most recent redeclaration that is pointed to by a first decl
// in a chained PCH, keep track of the association with the map so we can
// update the first decl during PCH reading.
// update the first decl during AST reading.
if (ThisDecl != First && First->getMostRecentDeclaration() == ThisDecl &&
First->getPCHLevel() > ThisDecl->getPCHLevel()) {
assert(Writer.FirstLatestDecls.find(First) == Writer.FirstLatestDecls.end()
@ -1091,7 +1091,7 @@ void ASTWriter::WriteDeclsBlockAbbrevs() {
/// isRequiredDecl - Check if this is a "required" Decl, which must be seen by
/// consumers of the AST.
///
/// Such decls will always be deserialized from the PCH file, so we would like
/// Such decls will always be deserialized from the AST file, so we would like
/// this to be as restrictive as possible. Currently the predicate is driven by
/// code generation requirements, if other clients have a different notion of
/// what is "required" then we may have to consider an alternate scheme where
@ -1110,7 +1110,7 @@ static bool isRequiredDecl(const Decl *D, ASTContext &Context) {
void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
RecordData Record;
PCHDeclWriter W(*this, Context, Record);
ASTDeclWriter W(*this, Context, Record);
// If this declaration is also a DeclContext, write blocks for the
// declarations that lexically stored inside its context and those
@ -1166,7 +1166,7 @@ void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
FlushStmts();
// Note "external" declarations so that we can add them to a record in the
// PCH file later.
// AST file later.
//
// FIXME: This should be renamed, the predicate is much more complicated.
if (isRequiredDecl(D, Context))

View File

@ -23,14 +23,14 @@ using namespace clang;
//===----------------------------------------------------------------------===//
namespace clang {
class PCHStmtWriter : public StmtVisitor<PCHStmtWriter, void> {
class ASTStmtWriter : public StmtVisitor<ASTStmtWriter, void> {
ASTWriter &Writer;
ASTWriter::RecordData &Record;
public:
pch::StmtCode Code;
PCHStmtWriter(ASTWriter &Writer, ASTWriter::RecordData &Record)
ASTStmtWriter(ASTWriter &Writer, ASTWriter::RecordData &Record)
: Writer(Writer), Record(Record) { }
void
@ -155,7 +155,7 @@ namespace clang {
};
}
void PCHStmtWriter::
void ASTStmtWriter::
AddExplicitTemplateArgumentList(const ExplicitTemplateArgumentList &Args) {
Writer.AddSourceLocation(Args.LAngleLoc, Record);
Writer.AddSourceLocation(Args.RAngleLoc, Record);
@ -163,16 +163,16 @@ AddExplicitTemplateArgumentList(const ExplicitTemplateArgumentList &Args) {
Writer.AddTemplateArgumentLoc(Args.getTemplateArgs()[i], Record);
}
void PCHStmtWriter::VisitStmt(Stmt *S) {
void ASTStmtWriter::VisitStmt(Stmt *S) {
}
void PCHStmtWriter::VisitNullStmt(NullStmt *S) {
void ASTStmtWriter::VisitNullStmt(NullStmt *S) {
VisitStmt(S);
Writer.AddSourceLocation(S->getSemiLoc(), Record);
Code = pch::STMT_NULL;
}
void PCHStmtWriter::VisitCompoundStmt(CompoundStmt *S) {
void ASTStmtWriter::VisitCompoundStmt(CompoundStmt *S) {
VisitStmt(S);
Record.push_back(S->size());
for (CompoundStmt::body_iterator CS = S->body_begin(), CSEnd = S->body_end();
@ -183,12 +183,12 @@ void PCHStmtWriter::VisitCompoundStmt(CompoundStmt *S) {
Code = pch::STMT_COMPOUND;
}
void PCHStmtWriter::VisitSwitchCase(SwitchCase *S) {
void ASTStmtWriter::VisitSwitchCase(SwitchCase *S) {
VisitStmt(S);
Record.push_back(Writer.getSwitchCaseID(S));
}
void PCHStmtWriter::VisitCaseStmt(CaseStmt *S) {
void ASTStmtWriter::VisitCaseStmt(CaseStmt *S) {
VisitSwitchCase(S);
Writer.AddStmt(S->getLHS());
Writer.AddStmt(S->getRHS());
@ -199,7 +199,7 @@ void PCHStmtWriter::VisitCaseStmt(CaseStmt *S) {
Code = pch::STMT_CASE;
}
void PCHStmtWriter::VisitDefaultStmt(DefaultStmt *S) {
void ASTStmtWriter::VisitDefaultStmt(DefaultStmt *S) {
VisitSwitchCase(S);
Writer.AddStmt(S->getSubStmt());
Writer.AddSourceLocation(S->getDefaultLoc(), Record);
@ -207,7 +207,7 @@ void PCHStmtWriter::VisitDefaultStmt(DefaultStmt *S) {
Code = pch::STMT_DEFAULT;
}
void PCHStmtWriter::VisitLabelStmt(LabelStmt *S) {
void ASTStmtWriter::VisitLabelStmt(LabelStmt *S) {
VisitStmt(S);
Writer.AddIdentifierRef(S->getID(), Record);
Writer.AddStmt(S->getSubStmt());
@ -216,7 +216,7 @@ void PCHStmtWriter::VisitLabelStmt(LabelStmt *S) {
Code = pch::STMT_LABEL;
}
void PCHStmtWriter::VisitIfStmt(IfStmt *S) {
void ASTStmtWriter::VisitIfStmt(IfStmt *S) {
VisitStmt(S);
Writer.AddDeclRef(S->getConditionVariable(), Record);
Writer.AddStmt(S->getCond());
@ -227,7 +227,7 @@ void PCHStmtWriter::VisitIfStmt(IfStmt *S) {
Code = pch::STMT_IF;
}
void PCHStmtWriter::VisitSwitchStmt(SwitchStmt *S) {
void ASTStmtWriter::VisitSwitchStmt(SwitchStmt *S) {
VisitStmt(S);
Writer.AddDeclRef(S->getConditionVariable(), Record);
Writer.AddStmt(S->getCond());
@ -239,7 +239,7 @@ void PCHStmtWriter::VisitSwitchStmt(SwitchStmt *S) {
Code = pch::STMT_SWITCH;
}
void PCHStmtWriter::VisitWhileStmt(WhileStmt *S) {
void ASTStmtWriter::VisitWhileStmt(WhileStmt *S) {
VisitStmt(S);
Writer.AddDeclRef(S->getConditionVariable(), Record);
Writer.AddStmt(S->getCond());
@ -248,7 +248,7 @@ void PCHStmtWriter::VisitWhileStmt(WhileStmt *S) {
Code = pch::STMT_WHILE;
}
void PCHStmtWriter::VisitDoStmt(DoStmt *S) {
void ASTStmtWriter::VisitDoStmt(DoStmt *S) {
VisitStmt(S);
Writer.AddStmt(S->getCond());
Writer.AddStmt(S->getBody());
@ -258,7 +258,7 @@ void PCHStmtWriter::VisitDoStmt(DoStmt *S) {
Code = pch::STMT_DO;
}
void PCHStmtWriter::VisitForStmt(ForStmt *S) {
void ASTStmtWriter::VisitForStmt(ForStmt *S) {
VisitStmt(S);
Writer.AddStmt(S->getInit());
Writer.AddStmt(S->getCond());
@ -271,7 +271,7 @@ void PCHStmtWriter::VisitForStmt(ForStmt *S) {
Code = pch::STMT_FOR;
}
void PCHStmtWriter::VisitGotoStmt(GotoStmt *S) {
void ASTStmtWriter::VisitGotoStmt(GotoStmt *S) {
VisitStmt(S);
Record.push_back(Writer.GetLabelID(S->getLabel()));
Writer.AddSourceLocation(S->getGotoLoc(), Record);
@ -279,7 +279,7 @@ void PCHStmtWriter::VisitGotoStmt(GotoStmt *S) {
Code = pch::STMT_GOTO;
}
void PCHStmtWriter::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
void ASTStmtWriter::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
VisitStmt(S);
Writer.AddSourceLocation(S->getGotoLoc(), Record);
Writer.AddSourceLocation(S->getStarLoc(), Record);
@ -287,19 +287,19 @@ void PCHStmtWriter::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
Code = pch::STMT_INDIRECT_GOTO;
}
void PCHStmtWriter::VisitContinueStmt(ContinueStmt *S) {
void ASTStmtWriter::VisitContinueStmt(ContinueStmt *S) {
VisitStmt(S);
Writer.AddSourceLocation(S->getContinueLoc(), Record);
Code = pch::STMT_CONTINUE;
}
void PCHStmtWriter::VisitBreakStmt(BreakStmt *S) {
void ASTStmtWriter::VisitBreakStmt(BreakStmt *S) {
VisitStmt(S);
Writer.AddSourceLocation(S->getBreakLoc(), Record);
Code = pch::STMT_BREAK;
}
void PCHStmtWriter::VisitReturnStmt(ReturnStmt *S) {
void ASTStmtWriter::VisitReturnStmt(ReturnStmt *S) {
VisitStmt(S);
Writer.AddStmt(S->getRetValue());
Writer.AddSourceLocation(S->getReturnLoc(), Record);
@ -307,7 +307,7 @@ void PCHStmtWriter::VisitReturnStmt(ReturnStmt *S) {
Code = pch::STMT_RETURN;
}
void PCHStmtWriter::VisitDeclStmt(DeclStmt *S) {
void ASTStmtWriter::VisitDeclStmt(DeclStmt *S) {
VisitStmt(S);
Writer.AddSourceLocation(S->getStartLoc(), Record);
Writer.AddSourceLocation(S->getEndLoc(), Record);
@ -317,7 +317,7 @@ void PCHStmtWriter::VisitDeclStmt(DeclStmt *S) {
Code = pch::STMT_DECL;
}
void PCHStmtWriter::VisitAsmStmt(AsmStmt *S) {
void ASTStmtWriter::VisitAsmStmt(AsmStmt *S) {
VisitStmt(S);
Record.push_back(S->getNumOutputs());
Record.push_back(S->getNumInputs());
@ -350,21 +350,21 @@ void PCHStmtWriter::VisitAsmStmt(AsmStmt *S) {
Code = pch::STMT_ASM;
}
void PCHStmtWriter::VisitExpr(Expr *E) {
void ASTStmtWriter::VisitExpr(Expr *E) {
VisitStmt(E);
Writer.AddTypeRef(E->getType(), Record);
Record.push_back(E->isTypeDependent());
Record.push_back(E->isValueDependent());
}
void PCHStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) {
void ASTStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getLocation(), Record);
Record.push_back(E->getIdentType()); // FIXME: stable encoding
Code = pch::EXPR_PREDEFINED;
}
void PCHStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
VisitExpr(E);
Record.push_back(E->hasQualifier());
@ -387,14 +387,14 @@ void PCHStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
Code = pch::EXPR_DECL_REF;
}
void PCHStmtWriter::VisitIntegerLiteral(IntegerLiteral *E) {
void ASTStmtWriter::VisitIntegerLiteral(IntegerLiteral *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getLocation(), Record);
Writer.AddAPInt(E->getValue(), Record);
Code = pch::EXPR_INTEGER_LITERAL;
}
void PCHStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) {
void ASTStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) {
VisitExpr(E);
Writer.AddAPFloat(E->getValue(), Record);
Record.push_back(E->isExact());
@ -402,13 +402,13 @@ void PCHStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) {
Code = pch::EXPR_FLOATING_LITERAL;
}
void PCHStmtWriter::VisitImaginaryLiteral(ImaginaryLiteral *E) {
void ASTStmtWriter::VisitImaginaryLiteral(ImaginaryLiteral *E) {
VisitExpr(E);
Writer.AddStmt(E->getSubExpr());
Code = pch::EXPR_IMAGINARY_LITERAL;
}
void PCHStmtWriter::VisitStringLiteral(StringLiteral *E) {
void ASTStmtWriter::VisitStringLiteral(StringLiteral *E) {
VisitExpr(E);
Record.push_back(E->getByteLength());
Record.push_back(E->getNumConcatenated());
@ -416,14 +416,14 @@ void PCHStmtWriter::VisitStringLiteral(StringLiteral *E) {
// FIXME: String data should be stored as a blob at the end of the
// StringLiteral. However, we can't do so now because we have no
// provision for coping with abbreviations when we're jumping around
// the PCH file during deserialization.
// the AST file during deserialization.
Record.append(E->getString().begin(), E->getString().end());
for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
Writer.AddSourceLocation(E->getStrTokenLoc(I), Record);
Code = pch::EXPR_STRING_LITERAL;
}
void PCHStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {
void ASTStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {
VisitExpr(E);
Record.push_back(E->getValue());
Writer.AddSourceLocation(E->getLocation(), Record);
@ -431,7 +431,7 @@ void PCHStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {
Code = pch::EXPR_CHARACTER_LITERAL;
}
void PCHStmtWriter::VisitParenExpr(ParenExpr *E) {
void ASTStmtWriter::VisitParenExpr(ParenExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getLParen(), Record);
Writer.AddSourceLocation(E->getRParen(), Record);
@ -439,7 +439,7 @@ void PCHStmtWriter::VisitParenExpr(ParenExpr *E) {
Code = pch::EXPR_PAREN;
}
void PCHStmtWriter::VisitParenListExpr(ParenListExpr *E) {
void ASTStmtWriter::VisitParenListExpr(ParenListExpr *E) {
VisitExpr(E);
Record.push_back(E->NumExprs);
for (unsigned i=0; i != E->NumExprs; ++i)
@ -449,7 +449,7 @@ void PCHStmtWriter::VisitParenListExpr(ParenListExpr *E) {
Code = pch::EXPR_PAREN_LIST;
}
void PCHStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
void ASTStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
VisitExpr(E);
Writer.AddStmt(E->getSubExpr());
Record.push_back(E->getOpcode()); // FIXME: stable encoding
@ -457,7 +457,7 @@ void PCHStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
Code = pch::EXPR_UNARY_OPERATOR;
}
void PCHStmtWriter::VisitOffsetOfExpr(OffsetOfExpr *E) {
void ASTStmtWriter::VisitOffsetOfExpr(OffsetOfExpr *E) {
VisitExpr(E);
Record.push_back(E->getNumComponents());
Record.push_back(E->getNumExpressions());
@ -492,7 +492,7 @@ void PCHStmtWriter::VisitOffsetOfExpr(OffsetOfExpr *E) {
Code = pch::EXPR_OFFSETOF;
}
void PCHStmtWriter::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
void ASTStmtWriter::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
VisitExpr(E);
Record.push_back(E->isSizeOf());
if (E->isArgumentType())
@ -506,7 +506,7 @@ void PCHStmtWriter::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
Code = pch::EXPR_SIZEOF_ALIGN_OF;
}
void PCHStmtWriter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
void ASTStmtWriter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
VisitExpr(E);
Writer.AddStmt(E->getLHS());
Writer.AddStmt(E->getRHS());
@ -514,7 +514,7 @@ void PCHStmtWriter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
Code = pch::EXPR_ARRAY_SUBSCRIPT;
}
void PCHStmtWriter::VisitCallExpr(CallExpr *E) {
void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
VisitExpr(E);
Record.push_back(E->getNumArgs());
Writer.AddSourceLocation(E->getRParenLoc(), Record);
@ -525,7 +525,7 @@ void PCHStmtWriter::VisitCallExpr(CallExpr *E) {
Code = pch::EXPR_CALL;
}
void PCHStmtWriter::VisitMemberExpr(MemberExpr *E) {
void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
// Don't call VisitExpr, we'll write everything here.
Record.push_back(E->hasQualifier());
@ -558,7 +558,7 @@ void PCHStmtWriter::VisitMemberExpr(MemberExpr *E) {
Code = pch::EXPR_MEMBER;
}
void PCHStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
void ASTStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
VisitExpr(E);
Writer.AddStmt(E->getBase());
Writer.AddSourceLocation(E->getIsaMemberLoc(), Record);
@ -566,7 +566,7 @@ void PCHStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
Code = pch::EXPR_OBJC_ISA;
}
void PCHStmtWriter::VisitCastExpr(CastExpr *E) {
void ASTStmtWriter::VisitCastExpr(CastExpr *E) {
VisitExpr(E);
Record.push_back(E->path_size());
Writer.AddStmt(E->getSubExpr());
@ -577,7 +577,7 @@ void PCHStmtWriter::VisitCastExpr(CastExpr *E) {
Writer.AddCXXBaseSpecifier(**PI, Record);
}
void PCHStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
void ASTStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
VisitExpr(E);
Writer.AddStmt(E->getLHS());
Writer.AddStmt(E->getRHS());
@ -586,14 +586,14 @@ void PCHStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
Code = pch::EXPR_BINARY_OPERATOR;
}
void PCHStmtWriter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
void ASTStmtWriter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
VisitBinaryOperator(E);
Writer.AddTypeRef(E->getComputationLHSType(), Record);
Writer.AddTypeRef(E->getComputationResultType(), Record);
Code = pch::EXPR_COMPOUND_ASSIGN_OPERATOR;
}
void PCHStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
void ASTStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
VisitExpr(E);
Writer.AddStmt(E->getCond());
Writer.AddStmt(E->getLHS());
@ -603,25 +603,25 @@ void PCHStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
Code = pch::EXPR_CONDITIONAL_OPERATOR;
}
void PCHStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
VisitCastExpr(E);
Record.push_back(E->getCategory());
Code = pch::EXPR_IMPLICIT_CAST;
}
void PCHStmtWriter::VisitExplicitCastExpr(ExplicitCastExpr *E) {
void ASTStmtWriter::VisitExplicitCastExpr(ExplicitCastExpr *E) {
VisitCastExpr(E);
Writer.AddTypeSourceInfo(E->getTypeInfoAsWritten(), Record);
}
void PCHStmtWriter::VisitCStyleCastExpr(CStyleCastExpr *E) {
void ASTStmtWriter::VisitCStyleCastExpr(CStyleCastExpr *E) {
VisitExplicitCastExpr(E);
Writer.AddSourceLocation(E->getLParenLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_CSTYLE_CAST;
}
void PCHStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
void ASTStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getLParenLoc(), Record);
Writer.AddTypeSourceInfo(E->getTypeSourceInfo(), Record);
@ -630,7 +630,7 @@ void PCHStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
Code = pch::EXPR_COMPOUND_LITERAL;
}
void PCHStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
void ASTStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
VisitExpr(E);
Writer.AddStmt(E->getBase());
Writer.AddIdentifierRef(&E->getAccessor(), Record);
@ -638,7 +638,7 @@ void PCHStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
Code = pch::EXPR_EXT_VECTOR_ELEMENT;
}
void PCHStmtWriter::VisitInitListExpr(InitListExpr *E) {
void ASTStmtWriter::VisitInitListExpr(InitListExpr *E) {
VisitExpr(E);
Record.push_back(E->getNumInits());
for (unsigned I = 0, N = E->getNumInits(); I != N; ++I)
@ -651,7 +651,7 @@ void PCHStmtWriter::VisitInitListExpr(InitListExpr *E) {
Code = pch::EXPR_INIT_LIST;
}
void PCHStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
void ASTStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
VisitExpr(E);
Record.push_back(E->getNumSubExprs());
for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
@ -688,12 +688,12 @@ void PCHStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
Code = pch::EXPR_DESIGNATED_INIT;
}
void PCHStmtWriter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
void ASTStmtWriter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
VisitExpr(E);
Code = pch::EXPR_IMPLICIT_VALUE_INIT;
}
void PCHStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
void ASTStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
VisitExpr(E);
Writer.AddStmt(E->getSubExpr());
Writer.AddTypeSourceInfo(E->getWrittenTypeInfo(), Record);
@ -702,7 +702,7 @@ void PCHStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
Code = pch::EXPR_VA_ARG;
}
void PCHStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
void ASTStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getAmpAmpLoc(), Record);
Writer.AddSourceLocation(E->getLabelLoc(), Record);
@ -710,7 +710,7 @@ void PCHStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
Code = pch::EXPR_ADDR_LABEL;
}
void PCHStmtWriter::VisitStmtExpr(StmtExpr *E) {
void ASTStmtWriter::VisitStmtExpr(StmtExpr *E) {
VisitExpr(E);
Writer.AddStmt(E->getSubStmt());
Writer.AddSourceLocation(E->getLParenLoc(), Record);
@ -718,7 +718,7 @@ void PCHStmtWriter::VisitStmtExpr(StmtExpr *E) {
Code = pch::EXPR_STMT;
}
void PCHStmtWriter::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) {
void ASTStmtWriter::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) {
VisitExpr(E);
Writer.AddTypeSourceInfo(E->getArgTInfo1(), Record);
Writer.AddTypeSourceInfo(E->getArgTInfo2(), Record);
@ -727,7 +727,7 @@ void PCHStmtWriter::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) {
Code = pch::EXPR_TYPES_COMPATIBLE;
}
void PCHStmtWriter::VisitChooseExpr(ChooseExpr *E) {
void ASTStmtWriter::VisitChooseExpr(ChooseExpr *E) {
VisitExpr(E);
Writer.AddStmt(E->getCond());
Writer.AddStmt(E->getLHS());
@ -737,13 +737,13 @@ void PCHStmtWriter::VisitChooseExpr(ChooseExpr *E) {
Code = pch::EXPR_CHOOSE;
}
void PCHStmtWriter::VisitGNUNullExpr(GNUNullExpr *E) {
void ASTStmtWriter::VisitGNUNullExpr(GNUNullExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getTokenLocation(), Record);
Code = pch::EXPR_GNU_NULL;
}
void PCHStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
void ASTStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
VisitExpr(E);
Record.push_back(E->getNumSubExprs());
for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I)
@ -753,14 +753,14 @@ void PCHStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
Code = pch::EXPR_SHUFFLE_VECTOR;
}
void PCHStmtWriter::VisitBlockExpr(BlockExpr *E) {
void ASTStmtWriter::VisitBlockExpr(BlockExpr *E) {
VisitExpr(E);
Writer.AddDeclRef(E->getBlockDecl(), Record);
Record.push_back(E->hasBlockDeclRefExprs());
Code = pch::EXPR_BLOCK;
}
void PCHStmtWriter::VisitBlockDeclRefExpr(BlockDeclRefExpr *E) {
void ASTStmtWriter::VisitBlockDeclRefExpr(BlockDeclRefExpr *E) {
VisitExpr(E);
Writer.AddDeclRef(E->getDecl(), Record);
Writer.AddSourceLocation(E->getLocation(), Record);
@ -774,14 +774,14 @@ void PCHStmtWriter::VisitBlockDeclRefExpr(BlockDeclRefExpr *E) {
// Objective-C Expressions and Statements.
//===----------------------------------------------------------------------===//
void PCHStmtWriter::VisitObjCStringLiteral(ObjCStringLiteral *E) {
void ASTStmtWriter::VisitObjCStringLiteral(ObjCStringLiteral *E) {
VisitExpr(E);
Writer.AddStmt(E->getString());
Writer.AddSourceLocation(E->getAtLoc(), Record);
Code = pch::EXPR_OBJC_STRING_LITERAL;
}
void PCHStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
void ASTStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
VisitExpr(E);
Writer.AddTypeSourceInfo(E->getEncodedTypeSourceInfo(), Record);
Writer.AddSourceLocation(E->getAtLoc(), Record);
@ -789,7 +789,7 @@ void PCHStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
Code = pch::EXPR_OBJC_ENCODE;
}
void PCHStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
void ASTStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
VisitExpr(E);
Writer.AddSelectorRef(E->getSelector(), Record);
Writer.AddSourceLocation(E->getAtLoc(), Record);
@ -797,7 +797,7 @@ void PCHStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
Code = pch::EXPR_OBJC_SELECTOR_EXPR;
}
void PCHStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
void ASTStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
VisitExpr(E);
Writer.AddDeclRef(E->getProtocol(), Record);
Writer.AddSourceLocation(E->getAtLoc(), Record);
@ -805,7 +805,7 @@ void PCHStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
Code = pch::EXPR_OBJC_PROTOCOL_EXPR;
}
void PCHStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
void ASTStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
VisitExpr(E);
Writer.AddDeclRef(E->getDecl(), Record);
Writer.AddSourceLocation(E->getLocation(), Record);
@ -815,7 +815,7 @@ void PCHStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
Code = pch::EXPR_OBJC_IVAR_REF_EXPR;
}
void PCHStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
void ASTStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
VisitExpr(E);
Writer.AddDeclRef(E->getProperty(), Record);
Writer.AddSourceLocation(E->getLocation(), Record);
@ -823,7 +823,7 @@ void PCHStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
Code = pch::EXPR_OBJC_PROPERTY_REF_EXPR;
}
void PCHStmtWriter::VisitObjCImplicitSetterGetterRefExpr(
void ASTStmtWriter::VisitObjCImplicitSetterGetterRefExpr(
ObjCImplicitSetterGetterRefExpr *E) {
VisitExpr(E);
Writer.AddDeclRef(E->getGetterMethod(), Record);
@ -837,7 +837,7 @@ void PCHStmtWriter::VisitObjCImplicitSetterGetterRefExpr(
Code = pch::EXPR_OBJC_KVC_REF_EXPR;
}
void PCHStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
void ASTStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
VisitExpr(E);
Record.push_back(E->getNumArgs());
Record.push_back((unsigned)E->getReceiverKind()); // FIXME: stable encoding
@ -874,13 +874,13 @@ void PCHStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
Code = pch::EXPR_OBJC_MESSAGE_EXPR;
}
void PCHStmtWriter::VisitObjCSuperExpr(ObjCSuperExpr *E) {
void ASTStmtWriter::VisitObjCSuperExpr(ObjCSuperExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getLoc(), Record);
Code = pch::EXPR_OBJC_SUPER_EXPR;
}
void PCHStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
void ASTStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
VisitStmt(S);
Writer.AddStmt(S->getElement());
Writer.AddStmt(S->getCollection());
@ -890,7 +890,7 @@ void PCHStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
Code = pch::STMT_OBJC_FOR_COLLECTION;
}
void PCHStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
Writer.AddStmt(S->getCatchBody());
Writer.AddDeclRef(S->getCatchParamDecl(), Record);
Writer.AddSourceLocation(S->getAtCatchLoc(), Record);
@ -898,13 +898,13 @@ void PCHStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
Code = pch::STMT_OBJC_CATCH;
}
void PCHStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
void ASTStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
Writer.AddStmt(S->getFinallyBody());
Writer.AddSourceLocation(S->getAtFinallyLoc(), Record);
Code = pch::STMT_OBJC_FINALLY;
}
void PCHStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
Record.push_back(S->getNumCatchStmts());
Record.push_back(S->getFinallyStmt() != 0);
Writer.AddStmt(S->getTryBody());
@ -916,14 +916,14 @@ void PCHStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
Code = pch::STMT_OBJC_AT_TRY;
}
void PCHStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
void ASTStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
Writer.AddStmt(S->getSynchExpr());
Writer.AddStmt(S->getSynchBody());
Writer.AddSourceLocation(S->getAtSynchronizedLoc(), Record);
Code = pch::STMT_OBJC_AT_SYNCHRONIZED;
}
void PCHStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
void ASTStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
Writer.AddStmt(S->getThrowExpr());
Writer.AddSourceLocation(S->getThrowLoc(), Record);
Code = pch::STMT_OBJC_AT_THROW;
@ -933,7 +933,7 @@ void PCHStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
// C++ Expressions and Statements.
//===----------------------------------------------------------------------===//
void PCHStmtWriter::VisitCXXCatchStmt(CXXCatchStmt *S) {
void ASTStmtWriter::VisitCXXCatchStmt(CXXCatchStmt *S) {
VisitStmt(S);
Writer.AddSourceLocation(S->getCatchLoc(), Record);
Writer.AddDeclRef(S->getExceptionDecl(), Record);
@ -941,7 +941,7 @@ void PCHStmtWriter::VisitCXXCatchStmt(CXXCatchStmt *S) {
Code = pch::STMT_CXX_CATCH;
}
void PCHStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
void ASTStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
VisitStmt(S);
Record.push_back(S->getNumHandlers());
Writer.AddSourceLocation(S->getTryLoc(), Record);
@ -951,18 +951,18 @@ void PCHStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
Code = pch::STMT_CXX_TRY;
}
void PCHStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
void ASTStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
VisitCallExpr(E);
Record.push_back(E->getOperator());
Code = pch::EXPR_CXX_OPERATOR_CALL;
}
void PCHStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
void ASTStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
VisitCallExpr(E);
Code = pch::EXPR_CXX_MEMBER_CALL;
}
void PCHStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
void ASTStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
VisitExpr(E);
Record.push_back(E->getNumArgs());
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
@ -975,59 +975,59 @@ void PCHStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
Code = pch::EXPR_CXX_CONSTRUCT;
}
void PCHStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
void ASTStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
VisitCXXConstructExpr(E);
Writer.AddSourceLocation(E->getTypeBeginLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_CXX_TEMPORARY_OBJECT;
}
void PCHStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
VisitExplicitCastExpr(E);
Writer.AddSourceLocation(E->getOperatorLoc(), Record);
}
void PCHStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
void ASTStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
VisitCXXNamedCastExpr(E);
Code = pch::EXPR_CXX_STATIC_CAST;
}
void PCHStmtWriter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
void ASTStmtWriter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
VisitCXXNamedCastExpr(E);
Code = pch::EXPR_CXX_DYNAMIC_CAST;
}
void PCHStmtWriter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
void ASTStmtWriter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
VisitCXXNamedCastExpr(E);
Code = pch::EXPR_CXX_REINTERPRET_CAST;
}
void PCHStmtWriter::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
void ASTStmtWriter::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
VisitCXXNamedCastExpr(E);
Code = pch::EXPR_CXX_CONST_CAST;
}
void PCHStmtWriter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
void ASTStmtWriter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
VisitExplicitCastExpr(E);
Writer.AddSourceLocation(E->getTypeBeginLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_CXX_FUNCTIONAL_CAST;
}
void PCHStmtWriter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
void ASTStmtWriter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
VisitExpr(E);
Record.push_back(E->getValue());
Writer.AddSourceLocation(E->getLocation(), Record);
Code = pch::EXPR_CXX_BOOL_LITERAL;
}
void PCHStmtWriter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
void ASTStmtWriter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getLocation(), Record);
Code = pch::EXPR_CXX_NULL_PTR_LITERAL;
}
void PCHStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
void ASTStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
VisitExpr(E);
Writer.AddSourceRange(E->getSourceRange(), Record);
if (E->isTypeOperand()) {
@ -1039,21 +1039,21 @@ void PCHStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
}
}
void PCHStmtWriter::VisitCXXThisExpr(CXXThisExpr *E) {
void ASTStmtWriter::VisitCXXThisExpr(CXXThisExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getLocation(), Record);
Record.push_back(E->isImplicit());
Code = pch::EXPR_CXX_THIS;
}
void PCHStmtWriter::VisitCXXThrowExpr(CXXThrowExpr *E) {
void ASTStmtWriter::VisitCXXThrowExpr(CXXThrowExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getThrowLoc(), Record);
Writer.AddStmt(E->getSubExpr());
Code = pch::EXPR_CXX_THROW;
}
void PCHStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
void ASTStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
VisitExpr(E);
bool HasOtherExprStored = E->Param.getInt();
@ -1067,14 +1067,14 @@ void PCHStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
Code = pch::EXPR_CXX_DEFAULT_ARG;
}
void PCHStmtWriter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
void ASTStmtWriter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
VisitExpr(E);
Writer.AddCXXTemporary(E->getTemporary(), Record);
Writer.AddStmt(E->getSubExpr());
Code = pch::EXPR_CXX_BIND_TEMPORARY;
}
void PCHStmtWriter::VisitCXXBindReferenceExpr(CXXBindReferenceExpr *E) {
void ASTStmtWriter::VisitCXXBindReferenceExpr(CXXBindReferenceExpr *E) {
VisitExpr(E);
Writer.AddStmt(E->getSubExpr());
Record.push_back(E->extendsLifetime());
@ -1082,14 +1082,14 @@ void PCHStmtWriter::VisitCXXBindReferenceExpr(CXXBindReferenceExpr *E) {
Code = pch::EXPR_CXX_BIND_REFERENCE;
}
void PCHStmtWriter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
void ASTStmtWriter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getTypeBeginLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_CXX_SCALAR_VALUE_INIT;
}
void PCHStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
void ASTStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
VisitExpr(E);
Record.push_back(E->isGlobalNew());
Record.push_back(E->hasInitializer());
@ -1109,7 +1109,7 @@ void PCHStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
Code = pch::EXPR_CXX_NEW;
}
void PCHStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
void ASTStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
VisitExpr(E);
Record.push_back(E->isGlobalDelete());
Record.push_back(E->isArrayForm());
@ -1120,7 +1120,7 @@ void PCHStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
Code = pch::EXPR_CXX_DELETE;
}
void PCHStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
void ASTStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
VisitExpr(E);
Writer.AddStmt(E->getBase());
@ -1142,7 +1142,7 @@ void PCHStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
Code = pch::EXPR_CXX_PSEUDO_DESTRUCTOR;
}
void PCHStmtWriter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
void ASTStmtWriter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
VisitExpr(E);
Record.push_back(E->getNumTemporaries());
for (unsigned i = 0, e = E->getNumTemporaries(); i != e; ++i)
@ -1153,7 +1153,7 @@ void PCHStmtWriter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
}
void
PCHStmtWriter::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){
ASTStmtWriter::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){
VisitExpr(E);
// Don't emit anything here, NumTemplateArgs must be emitted first.
@ -1162,7 +1162,7 @@ PCHStmtWriter::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){
const ExplicitTemplateArgumentList &Args
= *E->getExplicitTemplateArgumentList();
assert(Args.NumTemplateArgs &&
"Num of template args was zero! PCH reading will mess up!");
"Num of template args was zero! AST reading will mess up!");
Record.push_back(Args.NumTemplateArgs);
AddExplicitTemplateArgumentList(Args);
} else {
@ -1186,7 +1186,7 @@ PCHStmtWriter::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){
}
void
PCHStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
ASTStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
VisitExpr(E);
// Don't emit anything here, NumTemplateArgs must be emitted first.
@ -1194,7 +1194,7 @@ PCHStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
if (E->hasExplicitTemplateArgs()) {
const ExplicitTemplateArgumentList &Args = E->getExplicitTemplateArgs();
assert(Args.NumTemplateArgs &&
"Num of template args was zero! PCH reading will mess up!");
"Num of template args was zero! AST reading will mess up!");
Record.push_back(Args.NumTemplateArgs);
AddExplicitTemplateArgumentList(Args);
} else {
@ -1210,7 +1210,7 @@ PCHStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
}
void
PCHStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
ASTStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
VisitExpr(E);
Record.push_back(E->arg_size());
for (CXXUnresolvedConstructExpr::arg_iterator
@ -1223,7 +1223,7 @@ PCHStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
Code = pch::EXPR_CXX_UNRESOLVED_CONSTRUCT;
}
void PCHStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
VisitExpr(E);
// Don't emit anything here, NumTemplateArgs must be emitted first.
@ -1231,7 +1231,7 @@ void PCHStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
if (E->hasExplicitTemplateArgs()) {
const ExplicitTemplateArgumentList &Args = E->getExplicitTemplateArgs();
assert(Args.NumTemplateArgs &&
"Num of template args was zero! PCH reading will mess up!");
"Num of template args was zero! AST reading will mess up!");
Record.push_back(Args.NumTemplateArgs);
AddExplicitTemplateArgumentList(Args);
} else {
@ -1252,7 +1252,7 @@ void PCHStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
Writer.AddSourceLocation(E->getNameLoc(), Record);
}
void PCHStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
void ASTStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
VisitOverloadExpr(E);
Record.push_back(E->isArrow());
Record.push_back(E->hasUnresolvedUsing());
@ -1262,7 +1262,7 @@ void PCHStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
Code = pch::EXPR_CXX_UNRESOLVED_MEMBER;
}
void PCHStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
void ASTStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
VisitOverloadExpr(E);
Record.push_back(E->requiresADL());
Record.push_back(E->isOverloaded());
@ -1270,7 +1270,7 @@ void PCHStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
Code = pch::EXPR_CXX_UNRESOLVED_LOOKUP;
}
void PCHStmtWriter::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) {
void ASTStmtWriter::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) {
VisitExpr(E);
Record.push_back(E->getTrait());
Writer.AddSourceRange(E->getSourceRange(), Record);
@ -1312,7 +1312,7 @@ unsigned ASTWriter::GetLabelID(LabelStmt *S) {
/// bitstream.
void ASTWriter::WriteSubStmt(Stmt *S) {
RecordData Record;
PCHStmtWriter Writer(*this, Record);
ASTStmtWriter Writer(*this, Record);
++NumStatements;
if (!S) {
@ -1332,7 +1332,7 @@ void ASTWriter::WriteSubStmt(Stmt *S) {
SourceManager &SrcMgr
= DeclIDs.begin()->first->getASTContext().getSourceManager();
S->dump(SrcMgr);
assert(0 && "Unhandled sub statement writing PCH file");
assert(0 && "Unhandled sub statement writing AST file");
}
#endif