зеркало из https://github.com/microsoft/clang-1.git
Remove the serialization code that predates precompiled
headers. Future approaches to (de-)serializing ASTs will be based on the PCH infrastructure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69828 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
6cfc1a8b75
Коммит
370187c8a3
|
@ -25,7 +25,6 @@
|
|||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/FoldingSet.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/Bitcode/SerializationFwd.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include <vector>
|
||||
|
||||
|
@ -167,11 +166,6 @@ public:
|
|||
|
||||
TranslationUnitDecl *getTranslationUnitDecl() const { return TUDecl; }
|
||||
|
||||
/// This is intentionally not serialized. It is populated by the
|
||||
/// ASTContext ctor, and there are no external pointers/references to
|
||||
/// internal variables of BuiltinInfo.
|
||||
// FIXME: PCH does serialize this information, so that we don't have to
|
||||
// construct it again when the PCH is loaded.
|
||||
Builtin::Context BuiltinInfo;
|
||||
|
||||
// Builtin Types.
|
||||
|
@ -699,17 +693,6 @@ public:
|
|||
const_type_iterator types_begin() const { return Types.begin(); }
|
||||
const_type_iterator types_end() const { return Types.end(); }
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Serialization
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
void EmitASTBitcodeBuffer(std::vector<unsigned char> &Buffer) const;
|
||||
static ASTContext *ReadASTBitcodeBuffer(llvm::MemoryBuffer &MBuffer,
|
||||
FileManager &FMgr);
|
||||
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
static ASTContext *Create(llvm::Deserializer& D);
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Integer Values
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
|
|
@ -25,10 +25,6 @@ class CompoundStmt;
|
|||
class StringLiteral;
|
||||
|
||||
/// TranslationUnitDecl - The top declaration context.
|
||||
/// FIXME: The TranslationUnit class should probably be modified to serve as
|
||||
/// the top decl context. It would have ownership of the top decls so that the
|
||||
/// AST is self-contained and easily de/serializable.
|
||||
/// FIXME: TranslationUnitDecl isn't really a Decl (!)
|
||||
class TranslationUnitDecl : public Decl, public DeclContext {
|
||||
TranslationUnitDecl()
|
||||
: Decl(TranslationUnit, 0, SourceLocation()),
|
||||
|
@ -44,15 +40,6 @@ public:
|
|||
static TranslationUnitDecl *castFromDeclContext(const DeclContext *DC) {
|
||||
return static_cast<TranslationUnitDecl *>(const_cast<DeclContext*>(DC));
|
||||
}
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this TranslationUnitDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a TranslationUnitDecl. Called by Decl::Create.
|
||||
static TranslationUnitDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// NamedDecl - This represents a decl with a name. Many decls have names such
|
||||
|
@ -120,10 +107,6 @@ public:
|
|||
return D->getKind() >= NamedFirst && D->getKind() <= NamedLast;
|
||||
}
|
||||
static bool classof(const NamedDecl *D) { return true; }
|
||||
|
||||
protected:
|
||||
void EmitInRec(llvm::Serializer& S) const;
|
||||
void ReadInRec(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// NamespaceDecl - Represent a C++ namespace.
|
||||
|
@ -179,15 +162,6 @@ public:
|
|||
static NamespaceDecl *castFromDeclContext(const DeclContext *DC) {
|
||||
return static_cast<NamespaceDecl *>(const_cast<DeclContext*>(DC));
|
||||
}
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this NamespaceDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a NamespaceDecl. Called by Decl::Create.
|
||||
static NamespaceDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ValueDecl - Represent the declaration of a variable (in which case it is
|
||||
|
@ -209,10 +183,6 @@ public:
|
|||
return D->getKind() >= ValueFirst && D->getKind() <= ValueLast;
|
||||
}
|
||||
static bool classof(const ValueDecl *D) { return true; }
|
||||
|
||||
protected:
|
||||
void EmitInRec(llvm::Serializer& S) const;
|
||||
void ReadInRec(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// VarDecl - An instance of this class is created to represent a variable
|
||||
|
@ -393,22 +363,6 @@ public:
|
|||
return D->getKind() >= VarFirst && D->getKind() <= VarLast;
|
||||
}
|
||||
static bool classof(const VarDecl *D) { return true; }
|
||||
|
||||
protected:
|
||||
void EmitInRec(llvm::Serializer& S) const;
|
||||
void ReadInRec(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
void EmitOutRec(llvm::Serializer& S) const;
|
||||
void ReadOutRec(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
/// EmitImpl - Serialize this VarDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// ReadImpl - Deserialize this VarDecl. Called by subclasses.
|
||||
virtual void ReadImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
/// CreateImpl - Deserialize a VarDecl. Called by Decl::Create.
|
||||
static VarDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
class ImplicitParamDecl : public VarDecl {
|
||||
|
@ -492,15 +446,6 @@ public:
|
|||
D->getKind() == OriginalParmVar);
|
||||
}
|
||||
static bool classof(const ParmVarDecl *D) { return true; }
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this ParmVarDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a ParmVarDecl. Called by Decl::Create.
|
||||
static ParmVarDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// OriginalParmVarDecl - Represent a parameter to a function, when
|
||||
|
@ -528,18 +473,6 @@ public:
|
|||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Decl *D) { return D->getKind() == OriginalParmVar; }
|
||||
static bool classof(const OriginalParmVarDecl *D) { return true; }
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this OriginalParmVarDecl.
|
||||
/// Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a OriginalParmVarDecl.
|
||||
/// Called by Decl::Create.
|
||||
static OriginalParmVarDecl* CreateImpl(llvm::Deserializer& D,
|
||||
ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// FunctionDecl - An instance of this class is created to represent a
|
||||
|
@ -765,16 +698,6 @@ public:
|
|||
static FunctionDecl *castFromDeclContext(const DeclContext *DC) {
|
||||
return static_cast<FunctionDecl *>(const_cast<DeclContext*>(DC));
|
||||
}
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this FunctionDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a FunctionDecl. Called by Decl::Create.
|
||||
static FunctionDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
friend class CXXRecordDecl;
|
||||
};
|
||||
|
||||
|
||||
|
@ -821,15 +744,6 @@ public:
|
|||
return D->getKind() >= FieldFirst && D->getKind() <= FieldLast;
|
||||
}
|
||||
static bool classof(const FieldDecl *D) { return true; }
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this FieldDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a FieldDecl. Called by Decl::Create.
|
||||
static FieldDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// EnumConstantDecl - An instance of this object exists for each enum constant
|
||||
|
@ -867,15 +781,6 @@ public:
|
|||
static bool classof(const EnumConstantDecl *D) { return true; }
|
||||
|
||||
friend class StmtIteratorBase;
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this EnumConstantDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a EnumConstantDecl. Called by Decl::Create.
|
||||
static EnumConstantDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
|
||||
|
@ -932,15 +837,6 @@ public:
|
|||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Decl *D) { return D->getKind() == Typedef; }
|
||||
static bool classof(const TypedefDecl *D) { return true; }
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this TypedefDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a TypedefDecl. Called by Decl::Create.
|
||||
static TypedefDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
class TypedefDecl;
|
||||
|
@ -1090,15 +986,6 @@ public:
|
|||
|
||||
static bool classof(const Decl *D) { return D->getKind() == Enum; }
|
||||
static bool classof(const EnumDecl *D) { return true; }
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this EnumDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a EnumDecl. Called by Decl::Create.
|
||||
static EnumDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
|
||||
|
@ -1202,14 +1089,6 @@ public:
|
|||
return D->getKind() >= RecordFirst && D->getKind() <= RecordLast;
|
||||
}
|
||||
static bool classof(const RecordDecl *D) { return true; }
|
||||
protected:
|
||||
/// EmitImpl - Serialize this RecordDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a RecordDecl. Called by Decl::Create.
|
||||
static RecordDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
class FileScopeAsmDecl : public Decl {
|
||||
|
@ -1228,14 +1107,6 @@ public:
|
|||
return D->getKind() == FileScopeAsm;
|
||||
}
|
||||
static bool classof(const FileScopeAsmDecl *D) { return true; }
|
||||
protected:
|
||||
/// EmitImpl - Serialize this FileScopeAsmDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a FileScopeAsmDecl. Called by Decl::Create.
|
||||
static FileScopeAsmDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// BlockDecl - This represents a block literal declaration, which is like an
|
||||
|
@ -1300,15 +1171,6 @@ public:
|
|||
static BlockDecl *castFromDeclContext(const DeclContext *DC) {
|
||||
return static_cast<BlockDecl *>(const_cast<DeclContext*>(DC));
|
||||
}
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this BlockDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a BlockDecl. Called by Decl::Create.
|
||||
static BlockDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// Insertion operator for diagnostics. This allows sending NamedDecl's
|
||||
|
|
|
@ -297,22 +297,9 @@ public:
|
|||
static DeclContext *castToDeclContext(const Decl *);
|
||||
static Decl *castFromDeclContext(const DeclContext *);
|
||||
|
||||
/// Emit - Serialize this Decl to Bitcode.
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
|
||||
/// Create - Deserialize a Decl from Bitcode.
|
||||
static Decl* Create(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
/// Destroy - Call destructors and release memory.
|
||||
virtual void Destroy(ASTContext& C);
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Provides the subclass-specific serialization logic for
|
||||
/// serializing out a decl.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const {
|
||||
// FIXME: This will eventually be a pure virtual function.
|
||||
assert (false && "Not implemented.");
|
||||
}
|
||||
private:
|
||||
const Attr *getAttrsImpl() const;
|
||||
|
||||
|
@ -800,11 +787,6 @@ private:
|
|||
|
||||
void buildLookup(ASTContext &Context, DeclContext *DCtx);
|
||||
void makeDeclVisibleInContextImpl(ASTContext &Context, NamedDecl *D);
|
||||
|
||||
void EmitOutRec(llvm::Serializer& S) const;
|
||||
void ReadOutRec(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend class Decl;
|
||||
};
|
||||
|
||||
inline bool Decl::isTemplateParameter() const {
|
||||
|
|
|
@ -44,7 +44,11 @@ protected:
|
|||
/// Functions - the set of overloaded functions contained in this
|
||||
/// overload set.
|
||||
llvm::SmallVector<FunctionDecl *, 4> Functions;
|
||||
|
||||
|
||||
// FIXME: This should go away when we stop using
|
||||
// OverloadedFunctionDecl to store conversions in CXXRecordDecl.
|
||||
friend class CXXRecordDecl;
|
||||
|
||||
public:
|
||||
typedef llvm::SmallVector<FunctionDecl *, 4>::iterator function_iterator;
|
||||
typedef llvm::SmallVector<FunctionDecl *, 4>::const_iterator
|
||||
|
@ -97,18 +101,6 @@ public:
|
|||
return D->getKind() == OverloadedFunction;
|
||||
}
|
||||
static bool classof(const OverloadedFunctionDecl *D) { return true; }
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this FunctionDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize an OverloadedFunctionDecl. Called by
|
||||
/// Decl::Create.
|
||||
static OverloadedFunctionDecl* CreateImpl(llvm::Deserializer& D,
|
||||
ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
friend class CXXRecordDecl;
|
||||
};
|
||||
|
||||
/// CXXBaseSpecifier - A base class of a C++ class.
|
||||
|
@ -458,17 +450,6 @@ public:
|
|||
static bool classof(const ClassTemplateSpecializationDecl *D) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this CXXRecordDecl. Called by Decl::Emit.
|
||||
// FIXME: Implement this.
|
||||
//virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a CXXRecordDecl. Called by Decl::Create.
|
||||
// FIXME: Implement this.
|
||||
static CXXRecordDecl* CreateImpl(Kind DK, llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CXXMethodDecl - Represents a static or instance method of a
|
||||
|
@ -520,17 +501,6 @@ public:
|
|||
return D->getKind() >= CXXMethod && D->getKind() <= CXXConversion;
|
||||
}
|
||||
static bool classof(const CXXMethodDecl *D) { return true; }
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this CXXMethodDecl. Called by Decl::Emit.
|
||||
// FIXME: Implement this.
|
||||
//virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a CXXMethodDecl. Called by Decl::Create.
|
||||
// FIXME: Implement this.
|
||||
static CXXMethodDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CXXBaseOrMemberInitializer - Represents a C++ base or member
|
||||
|
@ -727,13 +697,6 @@ public:
|
|||
return D->getKind() == CXXConstructor;
|
||||
}
|
||||
static bool classof(const CXXConstructorDecl *D) { return true; }
|
||||
/// EmitImpl - Serialize this CXXConstructorDecl. Called by Decl::Emit.
|
||||
// FIXME: Implement this.
|
||||
//virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a CXXConstructorDecl. Called by Decl::Create.
|
||||
// FIXME: Implement this.
|
||||
static CXXConstructorDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CXXDestructorDecl - Represents a C++ destructor within a
|
||||
|
@ -791,13 +754,6 @@ public:
|
|||
return D->getKind() == CXXDestructor;
|
||||
}
|
||||
static bool classof(const CXXDestructorDecl *D) { return true; }
|
||||
/// EmitImpl - Serialize this CXXDestructorDecl. Called by Decl::Emit.
|
||||
// FIXME: Implement this.
|
||||
//virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a CXXDestructorDecl. Called by Decl::Create.
|
||||
// FIXME: Implement this.
|
||||
static CXXDestructorDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CXXConversionDecl - Represents a C++ conversion function within a
|
||||
|
@ -843,13 +799,6 @@ public:
|
|||
return D->getKind() == CXXConversion;
|
||||
}
|
||||
static bool classof(const CXXConversionDecl *D) { return true; }
|
||||
/// EmitImpl - Serialize this CXXConversionDecl. Called by Decl::Emit.
|
||||
// FIXME: Implement this.
|
||||
//virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a CXXConversionDecl. Called by Decl::Create.
|
||||
// FIXME: Implement this.
|
||||
static CXXConversionDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// LinkageSpecDecl - This represents a linkage specification. For example:
|
||||
|
@ -897,10 +846,6 @@ public:
|
|||
static LinkageSpecDecl *castFromDeclContext(const DeclContext *DC) {
|
||||
return static_cast<LinkageSpecDecl *>(const_cast<DeclContext*>(DC));
|
||||
}
|
||||
|
||||
protected:
|
||||
void EmitInRec(llvm::Serializer& S) const;
|
||||
void ReadInRec(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// UsingDirectiveDecl - Represents C++ using-directive. For example:
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#define LLVM_CLANG_AST_DECLGROUP_H
|
||||
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/Bitcode/SerializationFwd.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace clang {
|
||||
|
@ -48,12 +47,6 @@ public:
|
|||
assert (i < NumDecls && "Out-of-bounds access.");
|
||||
return *((Decl* const*) (this+1));
|
||||
}
|
||||
|
||||
/// Emit - Serialize a DeclGroup to Bitcode.
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
|
||||
/// Read - Deserialize a DeclGroup from Bitcode.
|
||||
static DeclGroup* Read(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
class DeclGroupRef {
|
||||
|
@ -136,12 +129,6 @@ public:
|
|||
X.D = static_cast<Decl*>(Ptr);
|
||||
return X;
|
||||
}
|
||||
|
||||
/// Emit - Serialize a DeclGroupRef to Bitcode.
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
|
||||
/// Read - Deserialize a DeclGroupRef from Bitcode.
|
||||
static DeclGroupRef ReadVal(llvm::Deserializer& D);
|
||||
};
|
||||
|
||||
} // end clang namespace
|
||||
|
|
|
@ -271,15 +271,6 @@ public:
|
|||
return D->getKind() == TemplateTypeParm;
|
||||
}
|
||||
static bool classof(const TemplateTypeParmDecl *D) { return true; }
|
||||
|
||||
protected:
|
||||
/// Serialize this TemplateTypeParmDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// Deserialize a TemplateTypeParmDecl. Called by Decl::Create.
|
||||
static TemplateTypeParmDecl* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// NonTypeTemplateParmDecl - Declares a non-type template parameter,
|
||||
|
@ -328,16 +319,6 @@ public:
|
|||
return D->getKind() == NonTypeTemplateParm;
|
||||
}
|
||||
static bool classof(const NonTypeTemplateParmDecl *D) { return true; }
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this TemplateTypeParmDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a TemplateTypeParmDecl. Called by Decl::Create.
|
||||
static NonTypeTemplateParmDecl* CreateImpl(llvm::Deserializer& D,
|
||||
ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// TemplateTemplateParmDecl - Declares a template template parameter,
|
||||
|
@ -389,16 +370,6 @@ public:
|
|||
return D->getKind() == TemplateTemplateParm;
|
||||
}
|
||||
static bool classof(const TemplateTemplateParmDecl *D) { return true; }
|
||||
|
||||
protected:
|
||||
/// EmitImpl - Serialize this TemplateTypeParmDecl. Called by Decl::Emit.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
|
||||
/// CreateImpl - Deserialize a TemplateTypeParmDecl. Called by Decl::Create.
|
||||
static TemplateTemplateParmDecl* CreateImpl(llvm::Deserializer& D,
|
||||
ASTContext& C);
|
||||
|
||||
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// \brief Represents a template argument within a class template
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
#include "clang/Basic/IdentifierTable.h"
|
||||
#include "clang/AST/Type.h"
|
||||
#include "llvm/Bitcode/SerializationFwd.h"
|
||||
|
||||
namespace llvm {
|
||||
template <typename T> struct DenseMapInfo;
|
||||
|
|
|
@ -294,10 +294,6 @@ public:
|
|||
T->getStmtClass() <= lastExprConstant;
|
||||
}
|
||||
static bool classof(const Expr *) { return true; }
|
||||
|
||||
static inline Expr* Create(llvm::Deserializer& D, ASTContext& C) {
|
||||
return cast<Expr>(Stmt::Create(D, C));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -352,9 +348,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static DeclRefExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// PredefinedExpr - [C99 6.4.2.2] - A predefined identifier such as __func__.
|
||||
|
@ -393,9 +386,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static PredefinedExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
class IntegerLiteral : public Expr {
|
||||
|
@ -432,9 +422,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static IntegerLiteral* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
class CharacterLiteral : public Expr {
|
||||
|
@ -469,9 +456,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CharacterLiteral* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
class FloatingLiteral : public Expr {
|
||||
|
@ -511,9 +495,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static FloatingLiteral* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ImaginaryLiteral - We support imaginary integer and floating point literals,
|
||||
|
@ -544,9 +525,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ImaginaryLiteral* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// StringLiteral - This represents a string literal expression, e.g. "foo"
|
||||
|
@ -636,9 +614,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static StringLiteral* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ParenExpr - This represents a parethesized expression, e.g. "(1)". This
|
||||
|
@ -678,9 +653,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ParenExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
|
||||
|
@ -782,9 +754,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static UnaryOperator* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// SizeOfAlignOfExpr - [C99 6.5.3.4] - This is for sizeof/alignof, both of
|
||||
|
@ -872,9 +841,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static SizeOfAlignOfExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -951,9 +917,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ArraySubscriptExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
|
||||
|
@ -1055,10 +1018,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CallExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C,
|
||||
StmtClass SC);
|
||||
};
|
||||
|
||||
/// MemberExpr - [C99 6.5.2.3] Structure and Union Members. X->F and X.F.
|
||||
|
@ -1118,9 +1077,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static MemberExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CompoundLiteralExpr - [C99 6.5.2.5]
|
||||
|
@ -1169,9 +1125,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CompoundLiteralExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CastExpr - Base class for type casts, including both implicit
|
||||
|
@ -1260,9 +1213,6 @@ public:
|
|||
return T->getStmtClass() == ImplicitCastExprClass;
|
||||
}
|
||||
static bool classof(const ImplicitCastExpr *) { return true; }
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ImplicitCastExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ExplicitCastExpr - An explicit cast written in the source
|
||||
|
@ -1341,9 +1291,6 @@ public:
|
|||
return T->getStmtClass() == CStyleCastExprClass;
|
||||
}
|
||||
static bool classof(const CStyleCastExpr *) { return true; }
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CStyleCastExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// \brief A builtin binary operation expression such as "x + y" or "x <= y".
|
||||
|
@ -1466,9 +1413,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static BinaryOperator* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
protected:
|
||||
BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy,
|
||||
|
@ -1520,10 +1464,6 @@ public:
|
|||
static bool classof(const Stmt *S) {
|
||||
return S->getStmtClass() == CompoundAssignOperatorClass;
|
||||
}
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CompoundAssignOperator* CreateImpl(llvm::Deserializer& D,
|
||||
ASTContext& C);
|
||||
};
|
||||
|
||||
/// ConditionalOperator - The ?: operator. Note that LHS may be null when the
|
||||
|
@ -1587,9 +1527,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ConditionalOperator* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// AddrLabelExpr - The GNU address of label extension, representing &&label.
|
||||
|
@ -1625,9 +1562,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static AddrLabelExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
|
||||
|
@ -1665,9 +1599,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static StmtExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// TypesCompatibleExpr - GNU builtin-in function __builtin_type_compatible_p.
|
||||
|
@ -1710,9 +1641,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static TypesCompatibleExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ShuffleVectorExpr - clang-specific builtin-in function
|
||||
|
@ -1790,9 +1718,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ShuffleVectorExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ChooseExpr - GNU builtin-in function __builtin_choose_expr.
|
||||
|
@ -1855,9 +1780,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ChooseExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// GNUNullExpr - Implements the GNU __null extension, which is a name
|
||||
|
@ -1892,9 +1814,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static GNUNullExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// VAArgExpr, used for the builtin function __builtin_va_start.
|
||||
|
@ -1932,9 +1851,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static VAArgExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// @brief Describes an C or C++ initializer list.
|
||||
|
@ -2085,14 +2001,6 @@ public:
|
|||
iterator end() { return InitExprs.end(); }
|
||||
reverse_iterator rbegin() { return InitExprs.rbegin(); }
|
||||
reverse_iterator rend() { return InitExprs.rend(); }
|
||||
|
||||
// Serailization.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static InitListExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
private:
|
||||
// Used by serializer.
|
||||
InitListExpr() : Expr(InitListExprClass, QualType()) {}
|
||||
};
|
||||
|
||||
/// @brief Represents a C99 designated initializer expression.
|
||||
|
@ -2476,9 +2384,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ExtVectorElementExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
|
||||
|
@ -2528,9 +2433,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static BlockExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// BlockDeclRefExpr - A reference to a declared variable, function,
|
||||
|
@ -2568,9 +2470,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static BlockDeclRefExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
|
|
@ -129,10 +129,6 @@ public:
|
|||
}
|
||||
}
|
||||
static bool classof(const CXXNamedCastExpr *) { return true; }
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CXXNamedCastExpr *CreateImpl(llvm::Deserializer& D, ASTContext& C,
|
||||
StmtClass SC);
|
||||
};
|
||||
|
||||
/// CXXStaticCastExpr - A C++ @c static_cast expression (C++ [expr.static.cast]).
|
||||
|
@ -276,9 +272,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CXXTypeidExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CXXThisExpr - Represents the "this" expression in C++, which is a
|
||||
|
@ -313,9 +306,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CXXThisExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CXXThrowExpr - [C++ 15] C++ Throw Expression. This handles
|
||||
|
@ -387,11 +377,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
// Serialization
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CXXDefaultArgExpr* CreateImpl(llvm::Deserializer& D,
|
||||
ASTContext& C);
|
||||
};
|
||||
|
||||
/// CXXFunctionalCastExpr - Represents an explicit C++ type conversion
|
||||
|
@ -417,10 +402,6 @@ public:
|
|||
return T->getStmtClass() == CXXFunctionalCastExprClass;
|
||||
}
|
||||
static bool classof(const CXXFunctionalCastExpr *) { return true; }
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CXXFunctionalCastExpr *
|
||||
CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// @brief Represents a C++ functional cast expression that builds a
|
||||
|
@ -482,9 +463,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CXXTemporaryObjectExpr *CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CXXZeroInitValueExpr - [C++ 5.2.3p2]
|
||||
|
@ -523,10 +501,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CXXZeroInitValueExpr *
|
||||
CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CXXConditionDeclExpr - Condition declaration of a if/switch/while/for
|
||||
|
@ -560,11 +534,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
// FIXME: Implement these.
|
||||
//virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
//static CXXConditionDeclExpr *
|
||||
// CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CXXNewExpr - A new expression for memory allocation and constructor calls,
|
||||
|
@ -600,19 +569,6 @@ class CXXNewExpr : public Expr {
|
|||
SourceLocation StartLoc;
|
||||
SourceLocation EndLoc;
|
||||
|
||||
// Deserialization constructor
|
||||
CXXNewExpr(QualType ty, bool globalNew, bool parenTypeId, bool initializer,
|
||||
bool array, unsigned numPlaceArgs, unsigned numConsArgs,
|
||||
Stmt **subExprs, FunctionDecl *operatorNew,
|
||||
FunctionDecl *operatorDelete, CXXConstructorDecl *constructor,
|
||||
SourceLocation startLoc, SourceLocation endLoc)
|
||||
: Expr(CXXNewExprClass, ty, ty->isDependentType(), ty->isDependentType()),
|
||||
GlobalNew(globalNew), ParenTypeId(parenTypeId),
|
||||
Initializer(initializer), Array(array), NumPlacementArgs(numPlaceArgs),
|
||||
NumConstructorArgs(numConsArgs), SubExprs(subExprs),
|
||||
OperatorNew(operatorNew), OperatorDelete(operatorDelete),
|
||||
Constructor(constructor), StartLoc(startLoc), EndLoc(endLoc)
|
||||
{ }
|
||||
public:
|
||||
CXXNewExpr(bool globalNew, FunctionDecl *operatorNew, Expr **placementArgs,
|
||||
unsigned numPlaceArgs, bool ParenTypeId, Expr *arraySize,
|
||||
|
@ -706,9 +662,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CXXNewExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CXXDeleteExpr - A delete expression for memory deallocation and destructor
|
||||
|
@ -751,9 +704,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CXXDeleteExpr * CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// \brief Represents the name of a function that has not been
|
||||
|
@ -800,9 +750,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static UnresolvedFunctionNameExpr *CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// UnaryTypeTraitExpr - A GCC or MS unary type trait, as used in the
|
||||
|
@ -845,9 +792,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static UnaryTypeTraitExpr *CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// QualifiedDeclRefExpr - A reference to a declared variable,
|
||||
|
@ -883,9 +827,6 @@ public:
|
|||
return T->getStmtClass() == QualifiedDeclRefExprClass;
|
||||
}
|
||||
static bool classof(const QualifiedDeclRefExpr *) { return true; }
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static QualifiedDeclRefExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// \brief A qualified reference to a name whose declaration cannot
|
||||
|
|
|
@ -53,9 +53,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCStringLiteral* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ObjCEncodeExpr, used for @encode in Objective-C. @encode has the same type
|
||||
|
@ -93,9 +90,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCEncodeExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ObjCSelectorExpr used for @selector in Objective-C.
|
||||
|
@ -132,9 +126,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCSelectorExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ObjCProtocolExpr used for protocol expression in Objective-C. This is used
|
||||
|
@ -172,9 +163,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCProtocolExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ObjCIvarRefExpr - A reference to an ObjC instance variable.
|
||||
|
@ -215,9 +203,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCIvarRefExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC
|
||||
|
@ -254,9 +239,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCPropertyRefExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ObjCKVCRefExpr - A dot-syntax expression to access "implicit" properties
|
||||
|
@ -319,9 +301,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCKVCRefExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
class ObjCMessageExpr : public Expr {
|
||||
|
@ -453,10 +432,6 @@ public:
|
|||
arg_iterator arg_end() { return &SubExprs[ARGS_START] + NumArgs; }
|
||||
const_arg_iterator arg_begin() const { return &SubExprs[ARGS_START]; }
|
||||
const_arg_iterator arg_end() const { return &SubExprs[ARGS_START] + NumArgs; }
|
||||
|
||||
// Serialization.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCMessageExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ObjCSuperExpr - Represents the "super" expression in Objective-C,
|
||||
|
@ -477,9 +452,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCSuperExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "clang/AST/DeclGroup.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/iterator.h"
|
||||
#include "llvm/Bitcode/SerializationFwd.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include <string>
|
||||
using llvm::dyn_cast_or_null;
|
||||
|
@ -221,14 +220,6 @@ public:
|
|||
const_child_iterator child_end() const {
|
||||
return const_child_iterator(const_cast<Stmt*>(this)->child_end());
|
||||
}
|
||||
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
static Stmt* Create(llvm::Deserializer& D, ASTContext& C);
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const {
|
||||
// This method will eventually be a pure-virtual function.
|
||||
assert (false && "Not implemented.");
|
||||
}
|
||||
};
|
||||
|
||||
/// DeclStmt - Adaptor class for mixing declarations with statements and
|
||||
|
@ -287,10 +278,6 @@ public:
|
|||
decl_iterator decl_end() { return DG.end(); }
|
||||
const_decl_iterator decl_begin() const { return DG.begin(); }
|
||||
const_decl_iterator decl_end() const { return DG.end(); }
|
||||
|
||||
// Serialization.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static DeclStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// NullStmt - This is the null statement ";": C99 6.8.3p3.
|
||||
|
@ -316,9 +303,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static NullStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CompoundStmt - This represents a group of statements like { stmt stmt }.
|
||||
|
@ -395,9 +379,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CompoundStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
// SwitchCase is the base class for CaseStmt and DefaultStmt,
|
||||
|
@ -483,9 +464,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CaseStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
class DefaultStmt : public SwitchCase {
|
||||
|
@ -517,9 +495,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static DefaultStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
class LabelStmt : public Stmt {
|
||||
|
@ -554,9 +529,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static LabelStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
|
||||
|
@ -607,9 +579,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static IfStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// SwitchStmt - This represents a 'switch' stmt.
|
||||
|
@ -663,9 +632,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static SwitchStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
|
||||
|
@ -706,9 +672,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static WhileStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// DoStmt - This represents a 'do/while' stmt.
|
||||
|
@ -749,9 +712,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static DoStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
|
||||
|
@ -805,9 +765,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ForStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// GotoStmt - This represents a direct goto.
|
||||
|
@ -842,9 +799,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static GotoStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// IndirectGotoStmt - This represents an indirect goto.
|
||||
|
@ -879,9 +833,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static IndirectGotoStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
|
||||
|
@ -909,9 +860,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ContinueStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// BreakStmt - This represents a break.
|
||||
|
@ -937,9 +885,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static BreakStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
|
||||
|
@ -979,9 +924,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ReturnStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// AsmStmt - This represents a GNU inline-assembly statement extension.
|
||||
|
@ -1213,9 +1155,6 @@ public:
|
|||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static AsmStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ObjCForCollectionStmt - This represents Objective-c's collection statement;
|
||||
|
@ -1255,9 +1194,6 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCForCollectionStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ObjCAtCatchStmt - This represents objective-c's @catch statement.
|
||||
|
@ -1310,9 +1246,6 @@ public:
|
|||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCAtCatchStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ObjCAtFinallyStmt - This represent objective-c's @finally Statement
|
||||
|
@ -1340,9 +1273,6 @@ public:
|
|||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCAtFinallyStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ObjCAtTryStmt - This represent objective-c's over-all
|
||||
|
@ -1390,9 +1320,6 @@ public:
|
|||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCAtTryStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// ObjCAtSynchronizedStmt - This is for objective-c's @synchronized statement.
|
||||
|
@ -1442,10 +1369,6 @@ public:
|
|||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCAtSynchronizedStmt* CreateImpl(llvm::Deserializer& D,
|
||||
ASTContext& C);
|
||||
};
|
||||
|
||||
/// ObjCAtThrowStmt - This represents objective-c's @throw statement.
|
||||
|
@ -1475,9 +1398,6 @@ public:
|
|||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCAtThrowStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CXXCatchStmt - This represents a C++ catch block.
|
||||
|
@ -1510,9 +1430,6 @@ public:
|
|||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CXXCatchStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
/// CXXTryStmt - A C++ try block, including all handlers.
|
||||
|
@ -1550,9 +1467,6 @@ public:
|
|||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static CXXTryStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "llvm/ADT/FoldingSet.h"
|
||||
#include "llvm/ADT/PointerIntPair.h"
|
||||
#include "llvm/ADT/PointerUnion.h"
|
||||
#include "llvm/Bitcode/SerializationFwd.h"
|
||||
|
||||
using llvm::isa;
|
||||
using llvm::cast;
|
||||
|
@ -203,14 +202,6 @@ public:
|
|||
bool isObjCGCStrong() const {
|
||||
return getObjCGCAttr() == Strong;
|
||||
}
|
||||
|
||||
/// Emit - Serialize a QualType to Bitcode.
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
|
||||
/// Read - Deserialize a QualType from Bitcode.
|
||||
static QualType ReadVal(llvm::Deserializer& D);
|
||||
|
||||
void ReadBackpatch(llvm::Deserializer& D);
|
||||
};
|
||||
|
||||
} // end clang.
|
||||
|
@ -301,9 +292,6 @@ protected:
|
|||
virtual void Destroy(ASTContext& C);
|
||||
friend class ASTContext;
|
||||
|
||||
void EmitTypeInternal(llvm::Serializer& S) const;
|
||||
void ReadTypeInternal(llvm::Deserializer& D);
|
||||
|
||||
public:
|
||||
TypeClass getTypeClass() const { return static_cast<TypeClass>(TC); }
|
||||
|
||||
|
@ -487,20 +475,6 @@ public:
|
|||
void dump() const;
|
||||
virtual void getAsStringInternal(std::string &InnerString) const = 0;
|
||||
static bool classof(const Type *) { return true; }
|
||||
|
||||
protected:
|
||||
/// Emit - Emit a Type to bitcode. Used by ASTContext.
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
|
||||
/// Create - Construct a Type from bitcode. Used by ASTContext.
|
||||
static void Create(ASTContext& Context, unsigned i, llvm::Deserializer& S);
|
||||
|
||||
/// EmitImpl - Subclasses must implement this method in order to
|
||||
/// be serialized.
|
||||
// FIXME: Make this abstract once implemented.
|
||||
virtual void EmitImpl(llvm::Serializer& S) const {
|
||||
assert(false && "Serialization for type not supported.");
|
||||
}
|
||||
};
|
||||
|
||||
/// ExtQualType - TR18037 (C embedded extensions) 6.2.5p26
|
||||
|
@ -546,11 +520,6 @@ public:
|
|||
|
||||
static bool classof(const Type *T) { return T->getTypeClass() == ExtQual; }
|
||||
static bool classof(const ExtQualType *) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context,llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
|
||||
|
@ -643,11 +612,6 @@ public:
|
|||
|
||||
static bool classof(const Type *T) { return T->getTypeClass() == Complex; }
|
||||
static bool classof(const ComplexType *) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context,llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// PointerType - C99 6.7.5.1 - Pointer Declarators.
|
||||
|
@ -674,11 +638,6 @@ public:
|
|||
|
||||
static bool classof(const Type *T) { return T->getTypeClass() == Pointer; }
|
||||
static bool classof(const PointerType *) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context,llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// BlockPointerType - pointer to a block type.
|
||||
|
@ -710,11 +669,6 @@ public:
|
|||
return T->getTypeClass() == BlockPointer;
|
||||
}
|
||||
static bool classof(const BlockPointerType *) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context,llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// ReferenceType - Base for LValueReferenceType and RValueReferenceType
|
||||
|
@ -742,9 +696,6 @@ public:
|
|||
T->getTypeClass() == RValueReference;
|
||||
}
|
||||
static bool classof(const ReferenceType *) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
};
|
||||
|
||||
/// LValueReferenceType - C++ [dcl.ref] - Lvalue reference
|
||||
|
@ -761,10 +712,6 @@ public:
|
|||
return T->getTypeClass() == LValueReference;
|
||||
}
|
||||
static bool classof(const LValueReferenceType *) { return true; }
|
||||
|
||||
protected:
|
||||
static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// RValueReferenceType - C++0x [dcl.ref] - Rvalue reference
|
||||
|
@ -781,10 +728,6 @@ public:
|
|||
return T->getTypeClass() == RValueReference;
|
||||
}
|
||||
static bool classof(const RValueReferenceType *) { return true; }
|
||||
|
||||
protected:
|
||||
static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// MemberPointerType - C++ 8.3.3 - Pointers to members
|
||||
|
@ -822,11 +765,6 @@ public:
|
|||
return T->getTypeClass() == MemberPointer;
|
||||
}
|
||||
static bool classof(const MemberPointerType *) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// ArrayType - C99 6.7.5.2 - Array Declarators.
|
||||
|
@ -910,11 +848,6 @@ public:
|
|||
return T->getTypeClass() == ConstantArray;
|
||||
}
|
||||
static bool classof(const ConstantArrayType *) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// IncompleteArrayType - This class represents C arrays with an unspecified
|
||||
|
@ -946,11 +879,6 @@ public:
|
|||
ID.AddInteger(SizeMod);
|
||||
ID.AddInteger(TypeQuals);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context,llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// VariableArrayType - This class represents C arrays with a specified size
|
||||
|
@ -998,11 +926,6 @@ public:
|
|||
void Profile(llvm::FoldingSetNodeID &ID) {
|
||||
assert(0 && "Cannnot unique VariableArrayTypes.");
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context,llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// DependentSizedArrayType - This type represents an array type in
|
||||
|
@ -1046,11 +969,6 @@ public:
|
|||
void Profile(llvm::FoldingSetNodeID &ID) {
|
||||
assert(0 && "Cannnot unique DependentSizedArrayTypes.");
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context,llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// VectorType - GCC generic vector type. This type is created using
|
||||
|
@ -1215,11 +1133,6 @@ public:
|
|||
return T->getTypeClass() == FunctionNoProto;
|
||||
}
|
||||
static bool classof(const FunctionNoProtoType *) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context,llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// FunctionProtoType - Represents a prototype with argument type info, e.g.
|
||||
|
@ -1283,11 +1196,6 @@ public:
|
|||
static void Profile(llvm::FoldingSetNodeID &ID, QualType Result,
|
||||
arg_type_iterator ArgTys, unsigned NumArgs,
|
||||
bool isVariadic, unsigned TypeQuals);
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context,llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1315,11 +1223,6 @@ public:
|
|||
|
||||
static bool classof(const Type *T) { return T->getTypeClass() == Typedef; }
|
||||
static bool classof(const TypedefType *) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context,llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// TypeOfExprType (GCC extension).
|
||||
|
@ -1334,11 +1237,6 @@ public:
|
|||
|
||||
static bool classof(const Type *T) { return T->getTypeClass() == TypeOfExpr; }
|
||||
static bool classof(const TypeOfExprType *) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// TypeOfType (GCC extension).
|
||||
|
@ -1356,11 +1254,6 @@ public:
|
|||
|
||||
static bool classof(const Type *T) { return T->getTypeClass() == TypeOf; }
|
||||
static bool classof(const TypeOfType *) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
class TagType : public Type {
|
||||
|
@ -1398,11 +1291,6 @@ public:
|
|||
static bool classof(const TagType *) { return true; }
|
||||
static bool classof(const RecordType *) { return true; }
|
||||
static bool classof(const EnumType *) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// RecordType - This is a helper class that allows the use of isa/cast/dyncast
|
||||
|
@ -1493,11 +1381,6 @@ public:
|
|||
return T->getTypeClass() == TemplateTypeParm;
|
||||
}
|
||||
static bool classof(const TemplateTypeParmType *T) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// \brief Represents the type of a template specialization as written
|
||||
|
@ -1577,11 +1460,6 @@ public:
|
|||
return T->getTypeClass() == TemplateSpecialization;
|
||||
}
|
||||
static bool classof(const TemplateSpecializationType *T) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// \brief Represents a type that was referred to via a qualified
|
||||
|
@ -1628,11 +1506,6 @@ public:
|
|||
return T->getTypeClass() == QualifiedName;
|
||||
}
|
||||
static bool classof(const QualifiedNameType *T) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// \brief Represents a 'typename' specifier that names a type within
|
||||
|
@ -1709,11 +1582,6 @@ public:
|
|||
return T->getTypeClass() == Typename;
|
||||
}
|
||||
static bool classof(const TypenameType *T) { return true; }
|
||||
|
||||
protected:
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static Type* CreateImpl(ASTContext& Context, llvm::Deserializer& D);
|
||||
friend class Type;
|
||||
};
|
||||
|
||||
/// ObjCInterfaceType - Interfaces are the core concept in Objective-C for
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/Bitcode/SerializationFwd.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Config/config.h" // for mode_t
|
||||
#include <map>
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/Bitcode/SerializationFwd.h"
|
||||
#include "llvm/Support/PointerLikeTypeTraits.h"
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
@ -207,12 +206,6 @@ public:
|
|||
/// know that HandleIdentifier will not affect the token.
|
||||
bool isHandleIdentifierCase() const { return NeedsHandleIdentifier; }
|
||||
|
||||
/// Emit - Serialize this IdentifierInfo to a bitstream.
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
|
||||
/// Read - Deserialize an IdentifierInfo object from a bitstream.
|
||||
void Read(llvm::Deserializer& D);
|
||||
|
||||
private:
|
||||
/// RecomputeNeedsHandleIdentifier - The Preprocessor::HandleIdentifier does
|
||||
/// several special (but rare) things to identifiers of various sorts. For
|
||||
|
@ -349,20 +342,6 @@ public:
|
|||
void PrintStats() const;
|
||||
|
||||
void AddKeywords(const LangOptions &LangOpts);
|
||||
|
||||
/// Emit - Serialize this IdentifierTable to a bitstream. This should
|
||||
/// be called AFTER objects that externally reference the identifiers in the
|
||||
/// table have been serialized. This is because only the identifiers that
|
||||
/// are actually referenced are serialized.
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
|
||||
/// Create - Deserialize an IdentifierTable from a bitstream.
|
||||
static IdentifierTable* CreateAndRegister(llvm::Deserializer& D);
|
||||
|
||||
private:
|
||||
/// This ctor is not intended to be used by anyone except for object
|
||||
/// serialization.
|
||||
IdentifierTable();
|
||||
};
|
||||
|
||||
/// Selector - This smart pointer class efficiently represents Objective-C
|
||||
|
@ -440,12 +419,6 @@ public:
|
|||
static Selector getTombstoneMarker() {
|
||||
return Selector(uintptr_t(-2));
|
||||
}
|
||||
|
||||
// Emit - Emit a selector to bitcode.
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
|
||||
// ReadVal - Read a selector from bitcode.
|
||||
static Selector ReadVal(llvm::Deserializer& D);
|
||||
};
|
||||
|
||||
/// SelectorTable - This table allows us to fully hide how we implement
|
||||
|
@ -484,12 +457,6 @@ public:
|
|||
&Idents.get(&SelectorName[0], &SelectorName[SelectorName.size()]);
|
||||
return SelTable.getUnarySelector(SetterName);
|
||||
}
|
||||
|
||||
// Emit - Emit a SelectorTable to bitcode.
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
|
||||
// Create - Reconstitute a SelectorTable from bitcode.
|
||||
static SelectorTable* CreateAndRegister(llvm::Deserializer& D);
|
||||
};
|
||||
|
||||
/// DeclarationNameExtra - Common base of the MultiKeywordSelector,
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#ifndef LLVM_CLANG_LANGOPTIONS_H
|
||||
#define LLVM_CLANG_LANGOPTIONS_H
|
||||
|
||||
#include "llvm/Bitcode/SerializationFwd.h"
|
||||
|
||||
namespace clang {
|
||||
|
||||
/// LangOptions - This class keeps track of the various options that can be
|
||||
|
@ -146,12 +144,6 @@ public:
|
|||
return (VisibilityMode) SymbolVisibility;
|
||||
}
|
||||
void setVisibilityMode(VisibilityMode v) { SymbolVisibility = (unsigned) v; }
|
||||
|
||||
/// Emit - Emit this LangOptions object to bitcode.
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
|
||||
/// Read - Read new values for this LangOption object from bitcode.
|
||||
void Read(llvm::Deserializer& S);
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#ifndef LLVM_CLANG_SOURCELOCATION_H
|
||||
#define LLVM_CLANG_SOURCELOCATION_H
|
||||
|
||||
#include "llvm/Bitcode/SerializationFwd.h"
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
|
@ -130,12 +129,6 @@ public:
|
|||
return X;
|
||||
}
|
||||
|
||||
/// Emit - Emit this SourceLocation object to Bitcode.
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
|
||||
/// ReadVal - Read a SourceLocation object from Bitcode.
|
||||
static SourceLocation ReadVal(llvm::Deserializer& D);
|
||||
|
||||
void print(llvm::raw_ostream &OS, const SourceManager &SM) const;
|
||||
void dump(const SourceManager &SM) const;
|
||||
};
|
||||
|
@ -176,12 +169,6 @@ public:
|
|||
bool operator!=(const SourceRange &X) const {
|
||||
return B != X.B || E != X.E;
|
||||
}
|
||||
|
||||
/// Emit - Emit this SourceRange object to Bitcode.
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
|
||||
/// ReadVal - Read a SourceRange object from Bitcode.
|
||||
static SourceRange ReadVal(llvm::Deserializer& D);
|
||||
};
|
||||
|
||||
/// FullSourceLoc - A SourceLocation and its associated SourceManager. Useful
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#define LLVM_CLANG_SOURCEMANAGER_H
|
||||
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "llvm/Bitcode/SerializationFwd.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
|
@ -106,14 +105,6 @@ namespace SrcMgr {
|
|||
NumLines = RHS.NumLines;
|
||||
}
|
||||
|
||||
/// Emit - Emit this ContentCache to Bitcode.
|
||||
void Emit(llvm::Serializer &S) const;
|
||||
|
||||
/// ReadToSourceManager - Reconstitute a ContentCache from Bitcode
|
||||
// and store it in the specified SourceManager.
|
||||
static void ReadToSourceManager(llvm::Deserializer &D, SourceManager &SM,
|
||||
FileManager *FMgr, std::vector<char> &Buf);
|
||||
|
||||
private:
|
||||
// Disable assignments.
|
||||
ContentCache &operator=(const ContentCache& RHS);
|
||||
|
@ -610,13 +601,6 @@ public:
|
|||
///
|
||||
void PrintStats() const;
|
||||
|
||||
/// Emit - Emit this SourceManager to Bitcode.
|
||||
void Emit(llvm::Serializer& S) const;
|
||||
|
||||
/// Read - Reconstitute a SourceManager from Bitcode.
|
||||
static SourceManager* CreateAndRegister(llvm::Deserializer& S,
|
||||
FileManager &FMgr);
|
||||
|
||||
// Iteration over the source location entry table.
|
||||
typedef std::vector<SrcMgr::SLocEntry>::const_iterator sloc_entry_iterator;
|
||||
|
||||
|
@ -638,8 +622,6 @@ public:
|
|||
unsigned getNextOffset() const { return NextOffset; }
|
||||
|
||||
private:
|
||||
friend class SrcMgr::ContentCache; // Used for deserialization.
|
||||
|
||||
/// isOffsetInFileID - Return true if the specified FileID contains the
|
||||
/// specified SourceLocation offset. This is a very hot method.
|
||||
inline bool isOffsetInFileID(FileID FID, unsigned SLocOffset) const {
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Basic/TargetInfo.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Bitcode/Serialize.h"
|
||||
#include "llvm/Bitcode/Deserialize.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
using namespace clang;
|
||||
|
@ -3223,182 +3221,6 @@ QualType ASTContext::getCorrespondingUnsignedType(QualType T) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Serialization Support
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
enum {
|
||||
BasicMetadataBlock = 1,
|
||||
ASTContextBlock = 2,
|
||||
DeclsBlock = 3
|
||||
};
|
||||
|
||||
void ASTContext::EmitASTBitcodeBuffer(std::vector<unsigned char> &Buffer) const{
|
||||
// Create bitstream.
|
||||
llvm::BitstreamWriter Stream(Buffer);
|
||||
|
||||
// Emit the preamble.
|
||||
Stream.Emit((unsigned)'B', 8);
|
||||
Stream.Emit((unsigned)'C', 8);
|
||||
Stream.Emit(0xC, 4);
|
||||
Stream.Emit(0xF, 4);
|
||||
Stream.Emit(0xE, 4);
|
||||
Stream.Emit(0x0, 4);
|
||||
|
||||
// Create serializer.
|
||||
llvm::Serializer S(Stream);
|
||||
|
||||
// ===---------------------------------------------------===/
|
||||
// Serialize the "Translation Unit" metadata.
|
||||
// ===---------------------------------------------------===/
|
||||
|
||||
// Emit ASTContext.
|
||||
S.EnterBlock(ASTContextBlock);
|
||||
S.EmitOwnedPtr(this);
|
||||
S.ExitBlock(); // exit "ASTContextBlock"
|
||||
|
||||
S.EnterBlock(BasicMetadataBlock);
|
||||
|
||||
// Block for SourceManager and Target. Allows easy skipping
|
||||
// around to the block for the Selectors during deserialization.
|
||||
S.EnterBlock();
|
||||
|
||||
// Emit the SourceManager.
|
||||
S.Emit(getSourceManager());
|
||||
|
||||
// Emit the Target.
|
||||
S.EmitPtr(&Target);
|
||||
S.EmitCStr(Target.getTargetTriple());
|
||||
|
||||
S.ExitBlock(); // exit "SourceManager and Target Block"
|
||||
|
||||
// Emit the Selectors.
|
||||
S.Emit(Selectors);
|
||||
|
||||
// Emit the Identifier Table.
|
||||
S.Emit(Idents);
|
||||
|
||||
S.ExitBlock(); // exit "BasicMetadataBlock"
|
||||
}
|
||||
|
||||
|
||||
/// Emit - Serialize an ASTContext object to Bitcode.
|
||||
void ASTContext::Emit(llvm::Serializer& S) const {
|
||||
S.Emit(LangOpts);
|
||||
S.EmitRef(SourceMgr);
|
||||
S.EmitRef(Target);
|
||||
S.EmitRef(Idents);
|
||||
S.EmitRef(Selectors);
|
||||
|
||||
// Emit the size of the type vector so that we can reserve that size
|
||||
// when we reconstitute the ASTContext object.
|
||||
S.EmitInt(Types.size());
|
||||
|
||||
for (std::vector<Type*>::const_iterator I=Types.begin(), E=Types.end();
|
||||
I!=E;++I)
|
||||
(*I)->Emit(S);
|
||||
|
||||
S.EmitOwnedPtr(TUDecl);
|
||||
|
||||
// FIXME: S.EmitOwnedPtr(CFConstantStringTypeDecl);
|
||||
}
|
||||
|
||||
|
||||
ASTContext *ASTContext::ReadASTBitcodeBuffer(llvm::MemoryBuffer &Buffer,
|
||||
FileManager &FMgr) {
|
||||
// Check if the file is of the proper length.
|
||||
if (Buffer.getBufferSize() & 0x3) {
|
||||
// FIXME: Provide diagnostic: "Length should be a multiple of 4 bytes."
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Create the bitstream reader.
|
||||
unsigned char *BufPtr = (unsigned char *)Buffer.getBufferStart();
|
||||
llvm::BitstreamReader Stream(BufPtr, BufPtr+Buffer.getBufferSize());
|
||||
|
||||
if (Stream.Read(8) != 'B' ||
|
||||
Stream.Read(8) != 'C' ||
|
||||
Stream.Read(4) != 0xC ||
|
||||
Stream.Read(4) != 0xF ||
|
||||
Stream.Read(4) != 0xE ||
|
||||
Stream.Read(4) != 0x0) {
|
||||
// FIXME: Provide diagnostic.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Create the deserializer.
|
||||
llvm::Deserializer Dezr(Stream);
|
||||
|
||||
// ===---------------------------------------------------===/
|
||||
// Deserialize the "Translation Unit" metadata.
|
||||
// ===---------------------------------------------------===/
|
||||
|
||||
// Skip to the BasicMetaDataBlock. First jump to ASTContextBlock
|
||||
// (which will appear earlier) and record its location.
|
||||
|
||||
bool FoundBlock = Dezr.SkipToBlock(ASTContextBlock);
|
||||
assert (FoundBlock);
|
||||
|
||||
llvm::Deserializer::Location ASTContextBlockLoc =
|
||||
Dezr.getCurrentBlockLocation();
|
||||
|
||||
FoundBlock = Dezr.SkipToBlock(BasicMetadataBlock);
|
||||
assert (FoundBlock);
|
||||
|
||||
// Read the SourceManager.
|
||||
SourceManager::CreateAndRegister(Dezr, FMgr);
|
||||
|
||||
{ // Read the TargetInfo.
|
||||
llvm::SerializedPtrID PtrID = Dezr.ReadPtrID();
|
||||
char* triple = Dezr.ReadCStr(NULL,0,true);
|
||||
Dezr.RegisterPtr(PtrID, TargetInfo::CreateTargetInfo(std::string(triple)));
|
||||
delete [] triple;
|
||||
}
|
||||
|
||||
// For Selectors, we must read the identifier table first because the
|
||||
// SelectorTable depends on the identifiers being already deserialized.
|
||||
llvm::Deserializer::Location SelectorBlkLoc = Dezr.getCurrentBlockLocation();
|
||||
Dezr.SkipBlock();
|
||||
|
||||
// Read the identifier table.
|
||||
IdentifierTable::CreateAndRegister(Dezr);
|
||||
|
||||
// Now jump back and read the selectors.
|
||||
Dezr.JumpTo(SelectorBlkLoc);
|
||||
SelectorTable::CreateAndRegister(Dezr);
|
||||
|
||||
// Now jump back to ASTContextBlock and read the ASTContext.
|
||||
Dezr.JumpTo(ASTContextBlockLoc);
|
||||
return Dezr.ReadOwnedPtr<ASTContext>();
|
||||
}
|
||||
|
||||
ASTContext* ASTContext::Create(llvm::Deserializer& D) {
|
||||
|
||||
// Read the language options.
|
||||
LangOptions LOpts;
|
||||
LOpts.Read(D);
|
||||
|
||||
SourceManager &SM = D.ReadRef<SourceManager>();
|
||||
TargetInfo &t = D.ReadRef<TargetInfo>();
|
||||
IdentifierTable &idents = D.ReadRef<IdentifierTable>();
|
||||
SelectorTable &sels = D.ReadRef<SelectorTable>();
|
||||
|
||||
unsigned size_reserve = D.ReadInt();
|
||||
|
||||
ASTContext* A = new ASTContext(LOpts, SM, t, idents, sels,
|
||||
size_reserve);
|
||||
|
||||
for (unsigned i = 0; i < size_reserve; ++i)
|
||||
Type::Create(*A,i,D);
|
||||
|
||||
A->TUDecl = cast<TranslationUnitDecl>(D.ReadOwnedPtr<Decl>(*A));
|
||||
|
||||
// FIXME: A->CFConstantStringTypeDecl = D.ReadOwnedPtr<RecordDecl>();
|
||||
|
||||
return A;
|
||||
}
|
||||
|
||||
ExternalASTSource::~ExternalASTSource() { }
|
||||
|
||||
void ExternalASTSource::PrintStats() { }
|
||||
|
|
|
@ -12,7 +12,6 @@ add_clang_library(clangAST
|
|||
DeclCXX.cpp
|
||||
DeclGroup.cpp
|
||||
DeclObjC.cpp
|
||||
DeclSerialization.cpp
|
||||
DeclTemplate.cpp
|
||||
ExprConstant.cpp
|
||||
Expr.cpp
|
||||
|
@ -24,11 +23,9 @@ add_clang_library(clangAST
|
|||
StmtDumper.cpp
|
||||
StmtIterator.cpp
|
||||
StmtPrinter.cpp
|
||||
StmtSerialization.cpp
|
||||
StmtViz.cpp
|
||||
TemplateName.cpp
|
||||
Type.cpp
|
||||
TypeSerialization.cpp
|
||||
)
|
||||
|
||||
add_dependencies(clangAST ClangDiagnosticAST)
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Bitcode/Serialize.h"
|
||||
#include "llvm/Bitcode/Deserialize.h"
|
||||
using namespace clang;
|
||||
|
||||
DeclGroup* DeclGroup::Create(ASTContext &C, Decl **Decls, unsigned NumDecls) {
|
||||
|
@ -27,24 +25,6 @@ DeclGroup* DeclGroup::Create(ASTContext &C, Decl **Decls, unsigned NumDecls) {
|
|||
return static_cast<DeclGroup*>(Mem);
|
||||
}
|
||||
|
||||
/// Emit - Serialize a DeclGroup to Bitcode.
|
||||
void DeclGroup::Emit(llvm::Serializer& S) const {
|
||||
S.EmitInt(NumDecls);
|
||||
S.BatchEmitOwnedPtrs(NumDecls, &(*this)[0]);
|
||||
}
|
||||
|
||||
/// Read - Deserialize a DeclGroup from Bitcode.
|
||||
DeclGroup* DeclGroup::Read(llvm::Deserializer& D, ASTContext& C) {
|
||||
unsigned NumDecls = (unsigned) D.ReadInt();
|
||||
unsigned Size = sizeof(DeclGroup) + sizeof(Decl*) * NumDecls;
|
||||
unsigned alignment = llvm::AlignOf<DeclGroup>::Alignment;
|
||||
DeclGroup* DG = (DeclGroup*) C.Allocate(Size, alignment);
|
||||
new (DG) DeclGroup();
|
||||
DG->NumDecls = NumDecls;
|
||||
D.BatchReadOwnedPtrs(NumDecls, &(*DG)[0], C);
|
||||
return DG;
|
||||
}
|
||||
|
||||
DeclGroup::DeclGroup(unsigned numdecls, Decl** decls) : NumDecls(numdecls) {
|
||||
assert(numdecls > 0);
|
||||
assert(decls);
|
||||
|
@ -55,20 +35,3 @@ void DeclGroup::Destroy(ASTContext& C) {
|
|||
this->~DeclGroup();
|
||||
C.Deallocate((void*) this);
|
||||
}
|
||||
|
||||
void DeclGroupRef::Emit(llvm::Serializer& S) const {
|
||||
if (isSingleDecl()) {
|
||||
S.EmitBool(false);
|
||||
S.EmitPtr(D);
|
||||
} else {
|
||||
S.EmitBool(true);
|
||||
S.EmitPtr(&getDeclGroup());
|
||||
}
|
||||
}
|
||||
|
||||
DeclGroupRef DeclGroupRef::ReadVal(llvm::Deserializer& D) {
|
||||
if (D.ReadBool())
|
||||
return DeclGroupRef(D.ReadPtr<Decl>());
|
||||
|
||||
return DeclGroupRef(D.ReadPtr<DeclGroup>());
|
||||
}
|
||||
|
|
|
@ -1,695 +0,0 @@
|
|||
//===--- DeclSerialization.cpp - Serialization of Decls ---------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines methods that implement bitcode serialization for Decls.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/DeclCXX.h"
|
||||
#include "clang/AST/DeclTemplate.h"
|
||||
#include "clang/AST/Expr.h"
|
||||
#include "llvm/Bitcode/Serialize.h"
|
||||
#include "llvm/Bitcode/Deserialize.h"
|
||||
|
||||
using llvm::Serializer;
|
||||
using llvm::Deserializer;
|
||||
using llvm::SerializedPtrID;
|
||||
|
||||
using namespace clang;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Decl Serialization: Dispatch code to handle specialized decl types.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void Decl::Emit(Serializer& S) const {
|
||||
S.EmitInt(getKind());
|
||||
EmitImpl(S);
|
||||
S.Emit(getLocation());
|
||||
S.EmitBool(InvalidDecl);
|
||||
// FIXME: HasAttrs?
|
||||
S.EmitBool(Implicit);
|
||||
S.EmitInt(IdentifierNamespace);
|
||||
S.EmitInt(Access);
|
||||
S.EmitPtr(cast_or_null<Decl>(getDeclContext())); // From Decl.
|
||||
S.EmitPtr(cast_or_null<Decl>(getLexicalDeclContext())); // From Decl.
|
||||
if (const DeclContext *DC = dyn_cast<const DeclContext>(this))
|
||||
DC->EmitOutRec(S);
|
||||
|
||||
if (getDeclContext() &&
|
||||
!getDeclContext()->isFunctionOrMethod()) {
|
||||
S.EmitBool(true);
|
||||
S.EmitOwnedPtr(NextDeclInContext);
|
||||
} else {
|
||||
S.EmitBool(false);
|
||||
S.EmitPtr(NextDeclInContext);
|
||||
}
|
||||
}
|
||||
|
||||
Decl* Decl::Create(Deserializer& D, ASTContext& C) {
|
||||
|
||||
Decl *Dcl;
|
||||
Kind k = static_cast<Kind>(D.ReadInt());
|
||||
|
||||
switch (k) {
|
||||
default:
|
||||
assert (false && "Not implemented.");
|
||||
|
||||
case TranslationUnit:
|
||||
Dcl = TranslationUnitDecl::CreateImpl(D, C);
|
||||
break;
|
||||
|
||||
case Namespace:
|
||||
Dcl = NamespaceDecl::CreateImpl(D, C);
|
||||
break;
|
||||
|
||||
case Var:
|
||||
Dcl = VarDecl::CreateImpl(D, C);
|
||||
break;
|
||||
|
||||
case Enum:
|
||||
Dcl = EnumDecl::CreateImpl(D, C);
|
||||
break;
|
||||
|
||||
case EnumConstant:
|
||||
Dcl = EnumConstantDecl::CreateImpl(D, C);
|
||||
break;
|
||||
|
||||
case Field:
|
||||
Dcl = FieldDecl::CreateImpl(D, C);
|
||||
break;
|
||||
|
||||
case ParmVar:
|
||||
Dcl = ParmVarDecl::CreateImpl(D, C);
|
||||
break;
|
||||
|
||||
case OriginalParmVar:
|
||||
Dcl = OriginalParmVarDecl::CreateImpl(D, C);
|
||||
break;
|
||||
|
||||
case Function:
|
||||
Dcl = FunctionDecl::CreateImpl(D, C);
|
||||
break;
|
||||
|
||||
case OverloadedFunction:
|
||||
Dcl = OverloadedFunctionDecl::CreateImpl(D, C);
|
||||
break;
|
||||
|
||||
case Record:
|
||||
Dcl = RecordDecl::CreateImpl(D, C);
|
||||
break;
|
||||
|
||||
case Typedef:
|
||||
Dcl = TypedefDecl::CreateImpl(D, C);
|
||||
break;
|
||||
|
||||
case TemplateTypeParm:
|
||||
Dcl = TemplateTypeParmDecl::CreateImpl(D, C);
|
||||
break;
|
||||
|
||||
case FileScopeAsm:
|
||||
Dcl = FileScopeAsmDecl::CreateImpl(D, C);
|
||||
break;
|
||||
}
|
||||
|
||||
Dcl->Loc = SourceLocation::ReadVal(D); // From Decl.
|
||||
Dcl->InvalidDecl = D.ReadBool();
|
||||
// FIXME: HasAttrs?
|
||||
Dcl->Implicit = D.ReadBool();
|
||||
Dcl->IdentifierNamespace = D.ReadInt();
|
||||
Dcl->Access = D.ReadInt();
|
||||
|
||||
assert(Dcl->DeclCtx.getOpaqueValue() == 0);
|
||||
|
||||
const SerializedPtrID &SemaDCPtrID = D.ReadPtrID();
|
||||
const SerializedPtrID &LexicalDCPtrID = D.ReadPtrID();
|
||||
|
||||
if (SemaDCPtrID == LexicalDCPtrID) {
|
||||
// Allow back-patching. Observe that we register the variable of the
|
||||
// *object* for back-patching. Its actual value will get filled in later.
|
||||
uintptr_t X;
|
||||
D.ReadUIntPtr(X, SemaDCPtrID);
|
||||
Dcl->DeclCtx = reinterpret_cast<DeclContext*>(X);
|
||||
} else {
|
||||
MultipleDC *MDC = new MultipleDC();
|
||||
Dcl->DeclCtx = MDC;
|
||||
// Allow back-patching. Observe that we register the variable of the
|
||||
// *object* for back-patching. Its actual value will get filled in later.
|
||||
D.ReadPtr(MDC->SemanticDC, SemaDCPtrID);
|
||||
D.ReadPtr(MDC->LexicalDC, LexicalDCPtrID);
|
||||
}
|
||||
if (DeclContext *DC = dyn_cast<DeclContext>(Dcl))
|
||||
DC->ReadOutRec(D, C);
|
||||
bool OwnsNext = D.ReadBool();
|
||||
if (OwnsNext)
|
||||
Dcl->NextDeclInContext = D.ReadOwnedPtr<Decl>(C);
|
||||
else
|
||||
D.ReadPtr(Dcl->NextDeclInContext);
|
||||
return Dcl;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Common serialization logic for subclasses of DeclContext.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void DeclContext::EmitOutRec(Serializer& S) const {
|
||||
bool Owned = !isFunctionOrMethod();
|
||||
S.EmitBool(Owned);
|
||||
if (Owned)
|
||||
S.EmitOwnedPtr(FirstDecl);
|
||||
else
|
||||
S.EmitPtr(FirstDecl);
|
||||
S.EmitPtr(LastDecl);
|
||||
}
|
||||
|
||||
void DeclContext::ReadOutRec(Deserializer& D, ASTContext& C) {
|
||||
bool Owned = D.ReadBool();
|
||||
if (Owned)
|
||||
FirstDecl = cast_or_null<Decl>(D.ReadOwnedPtr<Decl>(C));
|
||||
else
|
||||
D.ReadPtr(FirstDecl);
|
||||
D.ReadPtr(LastDecl);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Common serialization logic for subclasses of NamedDecl.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void NamedDecl::EmitInRec(Serializer& S) const {
|
||||
S.EmitInt(Name.getNameKind());
|
||||
|
||||
switch (Name.getNameKind()) {
|
||||
case DeclarationName::Identifier:
|
||||
S.EmitPtr(Name.getAsIdentifierInfo());
|
||||
break;
|
||||
|
||||
case DeclarationName::ObjCZeroArgSelector:
|
||||
case DeclarationName::ObjCOneArgSelector:
|
||||
case DeclarationName::ObjCMultiArgSelector:
|
||||
Name.getObjCSelector().Emit(S);
|
||||
break;
|
||||
|
||||
case DeclarationName::CXXConstructorName:
|
||||
case DeclarationName::CXXDestructorName:
|
||||
case DeclarationName::CXXConversionFunctionName:
|
||||
Name.getCXXNameType().Emit(S);
|
||||
break;
|
||||
|
||||
case DeclarationName::CXXOperatorName:
|
||||
S.EmitInt(Name.getCXXOverloadedOperator());
|
||||
break;
|
||||
|
||||
case DeclarationName::CXXUsingDirective:
|
||||
// No extra data to emit
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void NamedDecl::ReadInRec(Deserializer& D, ASTContext& C) {
|
||||
DeclarationName::NameKind Kind
|
||||
= static_cast<DeclarationName::NameKind>(D.ReadInt());
|
||||
switch (Kind) {
|
||||
case DeclarationName::Identifier: {
|
||||
// Don't allow back-patching. The IdentifierInfo table must already
|
||||
// be loaded.
|
||||
Name = D.ReadPtr<IdentifierInfo>();
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationName::ObjCZeroArgSelector:
|
||||
case DeclarationName::ObjCOneArgSelector:
|
||||
case DeclarationName::ObjCMultiArgSelector:
|
||||
Name = Selector::ReadVal(D);
|
||||
break;
|
||||
|
||||
case DeclarationName::CXXConstructorName:
|
||||
Name = C.DeclarationNames.getCXXConstructorName(QualType::ReadVal(D));
|
||||
break;
|
||||
|
||||
case DeclarationName::CXXDestructorName:
|
||||
Name = C.DeclarationNames.getCXXDestructorName(QualType::ReadVal(D));
|
||||
break;
|
||||
|
||||
case DeclarationName::CXXConversionFunctionName:
|
||||
Name
|
||||
= C.DeclarationNames.getCXXConversionFunctionName(QualType::ReadVal(D));
|
||||
break;
|
||||
|
||||
case DeclarationName::CXXOperatorName: {
|
||||
OverloadedOperatorKind Op
|
||||
= static_cast<OverloadedOperatorKind>(D.ReadInt());
|
||||
Name = C.DeclarationNames.getCXXOperatorName(Op);
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationName::CXXUsingDirective:
|
||||
Name = DeclarationName::getUsingDirectiveName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Common serialization logic for subclasses of ValueDecl.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ValueDecl::EmitInRec(Serializer& S) const {
|
||||
NamedDecl::EmitInRec(S);
|
||||
S.Emit(getType()); // From ValueDecl.
|
||||
}
|
||||
|
||||
void ValueDecl::ReadInRec(Deserializer& D, ASTContext& C) {
|
||||
NamedDecl::ReadInRec(D, C);
|
||||
DeclType = QualType::ReadVal(D); // From ValueDecl.
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Common serialization logic for subclasses of VarDecl.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void VarDecl::EmitInRec(Serializer& S) const {
|
||||
ValueDecl::EmitInRec(S);
|
||||
S.EmitInt(getStorageClass()); // From VarDecl.
|
||||
S.EmitBool(ThreadSpecified);
|
||||
S.EmitBool(HasCXXDirectInit);
|
||||
S.EmitBool(DeclaredInCondition);
|
||||
S.EmitPtr(PreviousDeclaration);
|
||||
S.Emit(TypeSpecStartLoc);
|
||||
}
|
||||
|
||||
void VarDecl::ReadInRec(Deserializer& D, ASTContext& C) {
|
||||
ValueDecl::ReadInRec(D, C);
|
||||
SClass = static_cast<StorageClass>(D.ReadInt()); // From VarDecl.
|
||||
ThreadSpecified = D.ReadBool();
|
||||
HasCXXDirectInit = D.ReadBool();
|
||||
DeclaredInCondition = D.ReadBool();
|
||||
D.ReadPtr(PreviousDeclaration);
|
||||
TypeSpecStartLoc = SourceLocation::ReadVal(D);
|
||||
}
|
||||
|
||||
void VarDecl::EmitOutRec(Serializer& S) const {
|
||||
// Emit this last because it will create a record of its own.
|
||||
S.EmitOwnedPtr(getInit());
|
||||
}
|
||||
|
||||
void VarDecl::ReadOutRec(Deserializer& D, ASTContext& C) {
|
||||
Init = D.ReadOwnedPtr<Stmt>(C);
|
||||
}
|
||||
|
||||
|
||||
void VarDecl::EmitImpl(Serializer& S) const {
|
||||
VarDecl::EmitInRec(S);
|
||||
VarDecl::EmitOutRec(S);
|
||||
}
|
||||
|
||||
void VarDecl::ReadImpl(Deserializer& D, ASTContext& C) {
|
||||
ReadInRec(D, C);
|
||||
ReadOutRec(D, C);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TranslationUnitDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void TranslationUnitDecl::EmitImpl(llvm::Serializer& S) const
|
||||
{
|
||||
}
|
||||
|
||||
TranslationUnitDecl* TranslationUnitDecl::CreateImpl(Deserializer& D,
|
||||
ASTContext& C) {
|
||||
return new (C) TranslationUnitDecl();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// NamespaceDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void NamespaceDecl::EmitImpl(llvm::Serializer& S) const
|
||||
{
|
||||
NamedDecl::EmitInRec(S);
|
||||
S.Emit(getLBracLoc());
|
||||
S.Emit(getRBracLoc());
|
||||
}
|
||||
|
||||
NamespaceDecl* NamespaceDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
NamespaceDecl* decl = new (C) NamespaceDecl(0, SourceLocation(), 0);
|
||||
|
||||
decl->NamedDecl::ReadInRec(D, C);
|
||||
decl->LBracLoc = SourceLocation::ReadVal(D);
|
||||
decl->RBracLoc = SourceLocation::ReadVal(D);
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// VarDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
VarDecl* VarDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
VarDecl* decl =
|
||||
new (C) VarDecl(Var, 0, SourceLocation(), NULL, QualType(), None);
|
||||
|
||||
decl->VarDecl::ReadImpl(D, C);
|
||||
return decl;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ParmVarDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ParmVarDecl::EmitImpl(llvm::Serializer& S) const {
|
||||
VarDecl::EmitImpl(S);
|
||||
S.EmitInt(getObjCDeclQualifier()); // From ParmVarDecl.
|
||||
S.EmitOwnedPtr(getDefaultArg()); // From ParmVarDecl.
|
||||
}
|
||||
|
||||
ParmVarDecl* ParmVarDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
ParmVarDecl* decl = new (C)
|
||||
ParmVarDecl(ParmVar,
|
||||
0, SourceLocation(), NULL, QualType(), None, NULL);
|
||||
|
||||
decl->VarDecl::ReadImpl(D, C);
|
||||
decl->objcDeclQualifier = static_cast<ObjCDeclQualifier>(D.ReadInt());
|
||||
decl->DefaultArg = D.ReadOwnedPtr<Expr>(C);
|
||||
return decl;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// OriginalParmVarDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void OriginalParmVarDecl::EmitImpl(llvm::Serializer& S) const {
|
||||
ParmVarDecl::EmitImpl(S);
|
||||
S.Emit(OriginalType);
|
||||
}
|
||||
|
||||
OriginalParmVarDecl* OriginalParmVarDecl::CreateImpl(
|
||||
Deserializer& D, ASTContext& C) {
|
||||
OriginalParmVarDecl* decl = new (C)
|
||||
OriginalParmVarDecl(0, SourceLocation(), NULL, QualType(),
|
||||
QualType(), None, NULL);
|
||||
|
||||
decl->ParmVarDecl::ReadImpl(D, C);
|
||||
decl->OriginalType = QualType::ReadVal(D);
|
||||
return decl;
|
||||
}
|
||||
//===----------------------------------------------------------------------===//
|
||||
// EnumDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void EnumDecl::EmitImpl(Serializer& S) const {
|
||||
NamedDecl::EmitInRec(S);
|
||||
S.EmitBool(isDefinition());
|
||||
S.Emit(IntegerType);
|
||||
}
|
||||
|
||||
EnumDecl* EnumDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
EnumDecl* decl = new (C) EnumDecl(0, SourceLocation(), NULL);
|
||||
|
||||
decl->NamedDecl::ReadInRec(D, C);
|
||||
decl->setDefinition(D.ReadBool());
|
||||
decl->IntegerType = QualType::ReadVal(D);
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// EnumConstantDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void EnumConstantDecl::EmitImpl(Serializer& S) const {
|
||||
S.Emit(Val);
|
||||
ValueDecl::EmitInRec(S);
|
||||
S.EmitOwnedPtr(Init);
|
||||
}
|
||||
|
||||
EnumConstantDecl* EnumConstantDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
llvm::APSInt val(1);
|
||||
D.Read(val);
|
||||
|
||||
EnumConstantDecl* decl = new (C)
|
||||
EnumConstantDecl(0, SourceLocation(), NULL, QualType(), NULL, val);
|
||||
|
||||
decl->ValueDecl::ReadInRec(D, C);
|
||||
decl->Init = D.ReadOwnedPtr<Stmt>(C);
|
||||
return decl;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// FieldDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void FieldDecl::EmitImpl(Serializer& S) const {
|
||||
S.EmitBool(Mutable);
|
||||
S.Emit(getType());
|
||||
ValueDecl::EmitInRec(S);
|
||||
S.EmitOwnedPtr(BitWidth);
|
||||
}
|
||||
|
||||
FieldDecl* FieldDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
FieldDecl* decl = new (C) FieldDecl(Field, 0, SourceLocation(), NULL,
|
||||
QualType(), 0, false);
|
||||
decl->Mutable = D.ReadBool();
|
||||
decl->ValueDecl::ReadInRec(D, C);
|
||||
decl->BitWidth = D.ReadOwnedPtr<Expr>(C);
|
||||
return decl;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// FunctionDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void FunctionDecl::EmitImpl(Serializer& S) const {
|
||||
S.EmitInt(SClass); // From FunctionDecl.
|
||||
S.EmitBool(IsInline); // From FunctionDecl.
|
||||
ValueDecl::EmitInRec(S);
|
||||
S.EmitPtr(PreviousDeclaration);
|
||||
|
||||
// NOTE: We do not need to serialize out the number of parameters, because
|
||||
// that is encoded in the type (accessed via getNumParams()).
|
||||
|
||||
if (ParamInfo != NULL) {
|
||||
S.EmitBool(true);
|
||||
S.EmitInt(getNumParams());
|
||||
// FIXME: S.BatchEmitOwnedPtrs(getNumParams(),&ParamInfo[0], Body);
|
||||
}
|
||||
else {
|
||||
S.EmitBool(false);
|
||||
// FIXME: S.EmitOwnedPtr(Body);
|
||||
}
|
||||
}
|
||||
|
||||
FunctionDecl* FunctionDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
StorageClass SClass = static_cast<StorageClass>(D.ReadInt());
|
||||
bool IsInline = D.ReadBool();
|
||||
|
||||
FunctionDecl* decl = new (C)
|
||||
FunctionDecl(Function, 0, SourceLocation(), DeclarationName(),
|
||||
QualType(), SClass, IsInline);
|
||||
|
||||
decl->ValueDecl::ReadInRec(D, C);
|
||||
D.ReadPtr(decl->PreviousDeclaration);
|
||||
|
||||
int numParams = 0;
|
||||
bool hasParamDecls = D.ReadBool();
|
||||
if (hasParamDecls)
|
||||
numParams = D.ReadInt();
|
||||
|
||||
decl->ParamInfo = hasParamDecls
|
||||
? new ParmVarDecl*[numParams]
|
||||
: NULL;
|
||||
|
||||
if (hasParamDecls)
|
||||
D.BatchReadOwnedPtrs(numParams,
|
||||
reinterpret_cast<Decl**>(&decl->ParamInfo[0]),
|
||||
/*FIXME: decl->Body,*/ C);
|
||||
else
|
||||
decl->Body = D.ReadOwnedPtr<Stmt>(C);
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
void BlockDecl::EmitImpl(Serializer& S) const {
|
||||
// FIXME: what about arguments?
|
||||
S.Emit(getCaretLocation());
|
||||
S.EmitOwnedPtr(Body);
|
||||
}
|
||||
|
||||
BlockDecl* BlockDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
QualType Q = QualType::ReadVal(D);
|
||||
SourceLocation L = SourceLocation::ReadVal(D);
|
||||
/*CompoundStmt* BodyStmt = cast<CompoundStmt>(*/D.ReadOwnedPtr<Stmt>(C)/*)*/;
|
||||
assert(0 && "Cannot deserialize BlockBlockExpr yet");
|
||||
// FIXME: need to handle parameters.
|
||||
//return new BlockBlockExpr(L, Q, BodyStmt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// OverloadedFunctionDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void OverloadedFunctionDecl::EmitImpl(Serializer& S) const {
|
||||
NamedDecl::EmitInRec(S);
|
||||
|
||||
S.EmitInt(getNumFunctions());
|
||||
for (unsigned func = 0; func < getNumFunctions(); ++func)
|
||||
S.EmitPtr(Functions[func]);
|
||||
}
|
||||
|
||||
OverloadedFunctionDecl *
|
||||
OverloadedFunctionDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
OverloadedFunctionDecl* decl = new (C)
|
||||
OverloadedFunctionDecl(0, DeclarationName());
|
||||
|
||||
decl->NamedDecl::ReadInRec(D, C);
|
||||
|
||||
unsigned numFunctions = D.ReadInt();
|
||||
decl->Functions.reserve(numFunctions);
|
||||
for (unsigned func = 0; func < numFunctions; ++func)
|
||||
D.ReadPtr(decl->Functions[func]);
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// RecordDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void RecordDecl::EmitImpl(Serializer& S) const {
|
||||
S.EmitInt(getTagKind());
|
||||
|
||||
NamedDecl::EmitInRec(S);
|
||||
S.EmitBool(isDefinition());
|
||||
S.EmitBool(hasFlexibleArrayMember());
|
||||
S.EmitBool(isAnonymousStructOrUnion());
|
||||
}
|
||||
|
||||
RecordDecl* RecordDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
TagKind TK = TagKind(D.ReadInt());
|
||||
|
||||
RecordDecl* decl = new (C) RecordDecl(Record, TK, 0, SourceLocation(), NULL);
|
||||
|
||||
decl->NamedDecl::ReadInRec(D, C);
|
||||
decl->setDefinition(D.ReadBool());
|
||||
decl->setHasFlexibleArrayMember(D.ReadBool());
|
||||
decl->setAnonymousStructOrUnion(D.ReadBool());
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TypedefDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void TypedefDecl::EmitImpl(Serializer& S) const {
|
||||
S.Emit(UnderlyingType);
|
||||
NamedDecl::EmitInRec(S);
|
||||
}
|
||||
|
||||
TypedefDecl* TypedefDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
QualType T = QualType::ReadVal(D);
|
||||
|
||||
TypedefDecl* decl = new (C) TypedefDecl(0, SourceLocation(), NULL, T);
|
||||
|
||||
decl->NamedDecl::ReadInRec(D, C);
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TemplateTypeParmDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void TemplateTypeParmDecl::EmitImpl(Serializer& S) const {
|
||||
S.EmitBool(Typename);
|
||||
TypeDecl::EmitInRec(S);
|
||||
}
|
||||
|
||||
TemplateTypeParmDecl *
|
||||
TemplateTypeParmDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
bool Typename = D.ReadBool();
|
||||
TemplateTypeParmDecl *decl
|
||||
= new (C) TemplateTypeParmDecl(0, SourceLocation(), 0, Typename,
|
||||
QualType());
|
||||
decl->TypeDecl::ReadInRec(D, C);
|
||||
return decl;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// NonTypeTemplateParmDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
void NonTypeTemplateParmDecl::EmitImpl(Serializer& S) const {
|
||||
S.EmitInt(Depth);
|
||||
S.EmitInt(Position);
|
||||
NamedDecl::Emit(S);
|
||||
}
|
||||
|
||||
NonTypeTemplateParmDecl*
|
||||
NonTypeTemplateParmDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
unsigned Depth = D.ReadInt();
|
||||
unsigned Position = D.ReadInt();
|
||||
NonTypeTemplateParmDecl *decl
|
||||
= new (C) NonTypeTemplateParmDecl(0, SourceLocation(), Depth, Position,
|
||||
0, QualType(), SourceLocation());
|
||||
decl->NamedDecl::ReadInRec(D, C);
|
||||
return decl;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TemplateTemplateParmDecl Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
void TemplateTemplateParmDecl::EmitImpl(Serializer& S) const {
|
||||
S.EmitInt(Depth);
|
||||
S.EmitInt(Position);
|
||||
NamedDecl::EmitInRec(S);
|
||||
}
|
||||
|
||||
TemplateTemplateParmDecl*
|
||||
TemplateTemplateParmDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
unsigned Depth = D.ReadInt();
|
||||
unsigned Position = D.ReadInt();
|
||||
TemplateTemplateParmDecl *decl
|
||||
= new (C) TemplateTemplateParmDecl(0, SourceLocation(), Depth, Position,
|
||||
0, 0);
|
||||
decl->NamedDecl::ReadInRec(D, C);
|
||||
return decl;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// LinkageSpec Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void LinkageSpecDecl::EmitInRec(Serializer& S) const {
|
||||
S.EmitInt(getLanguage());
|
||||
S.EmitBool(HadBraces);
|
||||
}
|
||||
|
||||
void LinkageSpecDecl::ReadInRec(Deserializer& D, ASTContext& C) {
|
||||
Language = static_cast<LanguageIDs>(D.ReadInt());
|
||||
HadBraces = D.ReadBool();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// FileScopeAsm Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void FileScopeAsmDecl::EmitImpl(llvm::Serializer& S) const
|
||||
{
|
||||
S.EmitOwnedPtr(AsmString);
|
||||
}
|
||||
|
||||
FileScopeAsmDecl* FileScopeAsmDecl::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
FileScopeAsmDecl* decl = new (C) FileScopeAsmDecl(0, SourceLocation(), 0);
|
||||
|
||||
decl->AsmString = cast<StringLiteral>(D.ReadOwnedPtr<Expr>(C));
|
||||
// D.ReadOwnedPtr(D.ReadOwnedPtr<StringLiteral>())<#T * * Ptr#>, <#bool AutoRegister#>)(decl->AsmString);
|
||||
|
||||
return decl;
|
||||
}
|
|
@ -15,9 +15,8 @@
|
|||
#include "clang/AST/Type.h"
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/Basic/IdentifierTable.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/FoldingSet.h"
|
||||
#include "llvm/Bitcode/Serialize.h"
|
||||
#include "llvm/Bitcode/Deserialize.h"
|
||||
using namespace clang;
|
||||
|
||||
namespace clang {
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,490 +0,0 @@
|
|||
//===--- TypeSerialization.cpp - Serialization of Decls ---------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines methods that implement bitcode serialization for Types.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/AST/Type.h"
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/DeclTemplate.h"
|
||||
#include "clang/AST/Expr.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "llvm/Bitcode/Serialize.h"
|
||||
#include "llvm/Bitcode/Deserialize.h"
|
||||
|
||||
using namespace clang;
|
||||
using llvm::Serializer;
|
||||
using llvm::Deserializer;
|
||||
using llvm::SerializedPtrID;
|
||||
|
||||
|
||||
void QualType::Emit(Serializer& S) const {
|
||||
S.EmitPtr(getTypePtr());
|
||||
S.EmitInt(getCVRQualifiers());
|
||||
}
|
||||
|
||||
QualType QualType::ReadVal(Deserializer& D) {
|
||||
uintptr_t Val;
|
||||
D.ReadUIntPtr(Val, false);
|
||||
return QualType(reinterpret_cast<Type*>(Val), D.ReadInt());
|
||||
}
|
||||
|
||||
void QualType::ReadBackpatch(Deserializer& D) {
|
||||
uintptr_t Val;
|
||||
D.ReadUIntPtr(Val, false);
|
||||
|
||||
Value.setPointer(reinterpret_cast<Type*>(Val));
|
||||
Value.setInt(D.ReadInt());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Type Serialization: Dispatch code to handle specific types.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void Type::Emit(Serializer& S) const {
|
||||
S.EmitInt(getTypeClass());
|
||||
S.EmitPtr(this);
|
||||
|
||||
if (!isa<BuiltinType>(this))
|
||||
EmitImpl(S);
|
||||
}
|
||||
|
||||
void Type::Create(ASTContext& Context, unsigned i, Deserializer& D) {
|
||||
Type::TypeClass K = static_cast<Type::TypeClass>(D.ReadInt());
|
||||
SerializedPtrID PtrID = D.ReadPtrID();
|
||||
|
||||
switch (K) {
|
||||
default:
|
||||
assert (false && "Deserialization for type not supported.");
|
||||
break;
|
||||
|
||||
case Type::Builtin:
|
||||
assert (i < Context.getTypes().size());
|
||||
assert (isa<BuiltinType>(Context.getTypes()[i]));
|
||||
D.RegisterPtr(PtrID,Context.getTypes()[i]);
|
||||
break;
|
||||
|
||||
case Type::ExtQual:
|
||||
D.RegisterPtr(PtrID,ExtQualType::CreateImpl(Context,D));
|
||||
break;
|
||||
|
||||
case Type::Complex:
|
||||
D.RegisterPtr(PtrID,ComplexType::CreateImpl(Context,D));
|
||||
break;
|
||||
|
||||
case Type::ConstantArray:
|
||||
D.RegisterPtr(PtrID,ConstantArrayType::CreateImpl(Context,D));
|
||||
break;
|
||||
|
||||
case Type::FunctionNoProto:
|
||||
D.RegisterPtr(PtrID,FunctionNoProtoType::CreateImpl(Context,D));
|
||||
break;
|
||||
|
||||
case Type::FunctionProto:
|
||||
D.RegisterPtr(PtrID,FunctionProtoType::CreateImpl(Context,D));
|
||||
break;
|
||||
|
||||
case Type::IncompleteArray:
|
||||
D.RegisterPtr(PtrID,IncompleteArrayType::CreateImpl(Context,D));
|
||||
break;
|
||||
|
||||
case Type::MemberPointer:
|
||||
D.RegisterPtr(PtrID, MemberPointerType::CreateImpl(Context, D));
|
||||
break;
|
||||
|
||||
case Type::Pointer:
|
||||
D.RegisterPtr(PtrID, PointerType::CreateImpl(Context, D));
|
||||
break;
|
||||
|
||||
case Type::BlockPointer:
|
||||
D.RegisterPtr(PtrID, BlockPointerType::CreateImpl(Context, D));
|
||||
break;
|
||||
|
||||
case Type::LValueReference:
|
||||
D.RegisterPtr(PtrID, LValueReferenceType::CreateImpl(Context, D));
|
||||
break;
|
||||
|
||||
case Type::RValueReference:
|
||||
D.RegisterPtr(PtrID, RValueReferenceType::CreateImpl(Context, D));
|
||||
break;
|
||||
|
||||
case Type::Record:
|
||||
case Type::Enum:
|
||||
// FIXME: Implement this!
|
||||
assert(false && "Can't deserialize tag types!");
|
||||
break;
|
||||
|
||||
case Type::Typedef:
|
||||
D.RegisterPtr(PtrID, TypedefType::CreateImpl(Context, D));
|
||||
break;
|
||||
|
||||
case Type::TypeOfExpr:
|
||||
D.RegisterPtr(PtrID, TypeOfExprType::CreateImpl(Context, D));
|
||||
break;
|
||||
|
||||
case Type::TypeOf:
|
||||
D.RegisterPtr(PtrID, TypeOfType::CreateImpl(Context, D));
|
||||
break;
|
||||
|
||||
case Type::TemplateTypeParm:
|
||||
D.RegisterPtr(PtrID, TemplateTypeParmType::CreateImpl(Context, D));
|
||||
break;
|
||||
|
||||
case Type::VariableArray:
|
||||
D.RegisterPtr(PtrID, VariableArrayType::CreateImpl(Context, D));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ExtQualType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ExtQualType::EmitImpl(Serializer& S) const {
|
||||
S.EmitPtr(getBaseType());
|
||||
S.EmitInt(getAddressSpace());
|
||||
}
|
||||
|
||||
Type* ExtQualType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
QualType BaseTy = QualType::ReadVal(D);
|
||||
unsigned AddressSpace = D.ReadInt();
|
||||
return Context.getAddrSpaceQualType(BaseTy, AddressSpace).getTypePtr();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// BlockPointerType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void BlockPointerType::EmitImpl(Serializer& S) const {
|
||||
S.Emit(getPointeeType());
|
||||
}
|
||||
|
||||
Type* BlockPointerType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
return Context.getBlockPointerType(QualType::ReadVal(D)).getTypePtr();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ComplexType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ComplexType::EmitImpl(Serializer& S) const {
|
||||
S.Emit(getElementType());
|
||||
}
|
||||
|
||||
Type* ComplexType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
return Context.getComplexType(QualType::ReadVal(D)).getTypePtr();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ConstantArray
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ConstantArrayType::EmitImpl(Serializer& S) const {
|
||||
S.Emit(getElementType());
|
||||
S.EmitInt(getSizeModifier());
|
||||
S.EmitInt(getIndexTypeQualifier());
|
||||
S.Emit(Size);
|
||||
}
|
||||
|
||||
Type* ConstantArrayType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
QualType ElTy = QualType::ReadVal(D);
|
||||
ArraySizeModifier am = static_cast<ArraySizeModifier>(D.ReadInt());
|
||||
unsigned ITQ = D.ReadInt();
|
||||
|
||||
llvm::APInt Size;
|
||||
D.Read(Size);
|
||||
|
||||
return Context.getConstantArrayType(ElTy,Size,am,ITQ).getTypePtr();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// FunctionNoProtoType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void FunctionNoProtoType::EmitImpl(Serializer& S) const {
|
||||
S.Emit(getResultType());
|
||||
}
|
||||
|
||||
Type* FunctionNoProtoType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
return Context.getFunctionNoProtoType(QualType::ReadVal(D)).getTypePtr();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// FunctionProtoType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void FunctionProtoType::EmitImpl(Serializer& S) const {
|
||||
S.Emit(getResultType());
|
||||
S.EmitBool(isVariadic());
|
||||
S.EmitInt(getTypeQuals());
|
||||
S.EmitInt(getNumArgs());
|
||||
|
||||
for (arg_type_iterator I=arg_type_begin(), E=arg_type_end(); I!=E; ++I)
|
||||
S.Emit(*I);
|
||||
}
|
||||
|
||||
Type* FunctionProtoType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
QualType ResultType = QualType::ReadVal(D);
|
||||
bool isVariadic = D.ReadBool();
|
||||
unsigned TypeQuals = D.ReadInt();
|
||||
unsigned NumArgs = D.ReadInt();
|
||||
|
||||
llvm::SmallVector<QualType,15> Args;
|
||||
|
||||
for (unsigned j = 0; j < NumArgs; ++j)
|
||||
Args.push_back(QualType::ReadVal(D));
|
||||
|
||||
return Context.getFunctionType(ResultType,&*Args.begin(),
|
||||
NumArgs,isVariadic,TypeQuals).getTypePtr();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// PointerType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void PointerType::EmitImpl(Serializer& S) const {
|
||||
S.Emit(getPointeeType());
|
||||
}
|
||||
|
||||
Type* PointerType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
return Context.getPointerType(QualType::ReadVal(D)).getTypePtr();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ReferenceType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ReferenceType::EmitImpl(Serializer& S) const {
|
||||
S.Emit(getPointeeType());
|
||||
}
|
||||
|
||||
Type* LValueReferenceType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
return Context.getLValueReferenceType(QualType::ReadVal(D)).getTypePtr();
|
||||
}
|
||||
|
||||
Type* RValueReferenceType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
return Context.getRValueReferenceType(QualType::ReadVal(D)).getTypePtr();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// MemberPointerType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void MemberPointerType::EmitImpl(Serializer& S) const {
|
||||
S.Emit(getPointeeType());
|
||||
S.Emit(QualType(Class, 0));
|
||||
}
|
||||
|
||||
Type* MemberPointerType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
QualType Pointee = QualType::ReadVal(D);
|
||||
QualType Class = QualType::ReadVal(D);
|
||||
return Context.getMemberPointerType(Pointee, Class.getTypePtr()).getTypePtr();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TagType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void TagType::EmitImpl(Serializer& S) const {
|
||||
S.EmitOwnedPtr(getDecl());
|
||||
}
|
||||
|
||||
Type* TagType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
std::vector<Type*>& Types =
|
||||
const_cast<std::vector<Type*>&>(Context.getTypes());
|
||||
|
||||
// FIXME: This is wrong: we need the subclasses to do the
|
||||
// (de-)serialization.
|
||||
TagType* T = new TagType(Record, NULL,QualType());
|
||||
Types.push_back(T);
|
||||
|
||||
// Deserialize the decl.
|
||||
T->decl.setPointer(cast<TagDecl>(D.ReadOwnedPtr<Decl>(Context)));
|
||||
T->decl.setInt(0);
|
||||
|
||||
return T;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TypedefType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void TypedefType::EmitImpl(Serializer& S) const {
|
||||
S.Emit(getCanonicalTypeInternal());
|
||||
S.EmitPtr(Decl);
|
||||
}
|
||||
|
||||
Type* TypedefType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
std::vector<Type*>& Types =
|
||||
const_cast<std::vector<Type*>&>(Context.getTypes());
|
||||
|
||||
TypedefType* T = new TypedefType(Type::Typedef, NULL, QualType::ReadVal(D));
|
||||
Types.push_back(T);
|
||||
|
||||
D.ReadPtr(T->Decl); // May be backpatched.
|
||||
return T;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TypeOfExprType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void TypeOfExprType::EmitImpl(llvm::Serializer& S) const {
|
||||
S.EmitOwnedPtr(TOExpr);
|
||||
}
|
||||
|
||||
Type* TypeOfExprType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
Expr* E = D.ReadOwnedPtr<Expr>(Context);
|
||||
|
||||
std::vector<Type*>& Types =
|
||||
const_cast<std::vector<Type*>&>(Context.getTypes());
|
||||
|
||||
TypeOfExprType* T
|
||||
= new TypeOfExprType(E, Context.getCanonicalType(E->getType()));
|
||||
Types.push_back(T);
|
||||
|
||||
return T;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TypeOfType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void TypeOfType::EmitImpl(llvm::Serializer& S) const {
|
||||
S.Emit(TOType);
|
||||
}
|
||||
|
||||
Type* TypeOfType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
QualType TOType = QualType::ReadVal(D);
|
||||
|
||||
std::vector<Type*>& Types =
|
||||
const_cast<std::vector<Type*>&>(Context.getTypes());
|
||||
|
||||
TypeOfType* T = new TypeOfType(TOType, Context.getCanonicalType(TOType));
|
||||
Types.push_back(T);
|
||||
|
||||
return T;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TemplateTypeParmType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void TemplateTypeParmType::EmitImpl(Serializer& S) const {
|
||||
S.EmitInt(Depth);
|
||||
S.EmitInt(Index);
|
||||
S.EmitPtr(Name);
|
||||
}
|
||||
|
||||
Type* TemplateTypeParmType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
unsigned Depth = D.ReadInt();
|
||||
unsigned Index = D.ReadInt();
|
||||
IdentifierInfo *Name = D.ReadPtr<IdentifierInfo>();
|
||||
return Context.getTemplateTypeParmType(Depth, Index, Name).getTypePtr();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TemplateSpecializationType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void TemplateSpecializationType::EmitImpl(Serializer& S) const {
|
||||
// FIXME: Serialization support
|
||||
}
|
||||
|
||||
Type*
|
||||
TemplateSpecializationType::
|
||||
CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
// FIXME: Deserialization support
|
||||
return 0;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// QualifiedNameType
|
||||
//===----------------------------------------------------------------------===//
|
||||
void QualifiedNameType::EmitImpl(llvm::Serializer& S) const {
|
||||
// FIXME: Serialize the actual components
|
||||
}
|
||||
|
||||
Type*
|
||||
QualifiedNameType::CreateImpl(ASTContext& Context, llvm::Deserializer& D) {
|
||||
// FIXME: Implement de-serialization
|
||||
return 0;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TypenameType
|
||||
//===----------------------------------------------------------------------===//
|
||||
void TypenameType::EmitImpl(llvm::Serializer& S) const {
|
||||
// FIXME: Serialize the actual components
|
||||
}
|
||||
|
||||
Type*
|
||||
TypenameType::CreateImpl(ASTContext& Context, llvm::Deserializer& D) {
|
||||
// FIXME: Implement de-serialization
|
||||
return 0;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// VariableArrayType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void VariableArrayType::EmitImpl(Serializer& S) const {
|
||||
S.Emit(getElementType());
|
||||
S.EmitInt(getSizeModifier());
|
||||
S.EmitInt(getIndexTypeQualifier());
|
||||
S.EmitOwnedPtr(SizeExpr);
|
||||
}
|
||||
|
||||
Type* VariableArrayType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
QualType ElTy = QualType::ReadVal(D);
|
||||
ArraySizeModifier am = static_cast<ArraySizeModifier>(D.ReadInt());
|
||||
unsigned ITQ = D.ReadInt();
|
||||
Expr* SizeExpr = D.ReadOwnedPtr<Expr>(Context);
|
||||
|
||||
return Context.getVariableArrayType(ElTy,SizeExpr,am,ITQ).getTypePtr();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// DependentSizedArrayType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void DependentSizedArrayType::EmitImpl(Serializer& S) const {
|
||||
S.Emit(getElementType());
|
||||
S.EmitInt(getSizeModifier());
|
||||
S.EmitInt(getIndexTypeQualifier());
|
||||
S.EmitOwnedPtr(SizeExpr);
|
||||
}
|
||||
|
||||
Type* DependentSizedArrayType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
QualType ElTy = QualType::ReadVal(D);
|
||||
ArraySizeModifier am = static_cast<ArraySizeModifier>(D.ReadInt());
|
||||
unsigned ITQ = D.ReadInt();
|
||||
Expr* SizeExpr = D.ReadOwnedPtr<Expr>(Context);
|
||||
|
||||
return Context.getDependentSizedArrayType(ElTy,SizeExpr,am,ITQ).getTypePtr();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// IncompleteArrayType
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void IncompleteArrayType::EmitImpl(Serializer& S) const {
|
||||
S.Emit(getElementType());
|
||||
S.EmitInt(getSizeModifier());
|
||||
S.EmitInt(getIndexTypeQualifier());
|
||||
}
|
||||
|
||||
Type* IncompleteArrayType::CreateImpl(ASTContext& Context, Deserializer& D) {
|
||||
QualType ElTy = QualType::ReadVal(D);
|
||||
ArraySizeModifier am = static_cast<ArraySizeModifier>(D.ReadInt());
|
||||
unsigned ITQ = D.ReadInt();
|
||||
|
||||
return Context.getIncompleteArrayType(ElTy,am,ITQ).getTypePtr();
|
||||
}
|
|
@ -5,7 +5,6 @@ add_clang_library(clangBasic
|
|||
Diagnostic.cpp
|
||||
FileManager.cpp
|
||||
IdentifierTable.cpp
|
||||
LangOptions.cpp
|
||||
SourceLocation.cpp
|
||||
SourceManager.cpp
|
||||
TargetInfo.cpp
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
#include "clang/Basic/FileManager.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/Bitcode/Serialize.h"
|
||||
#include "llvm/Bitcode/Deserialize.h"
|
||||
#include "llvm/Support/Streams.h"
|
||||
#include "llvm/Config/config.h"
|
||||
using namespace clang;
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
#include "clang/Basic/LangOptions.h"
|
||||
#include "llvm/ADT/FoldingSet.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/Bitcode/Serialize.h"
|
||||
#include "llvm/Bitcode/Deserialize.h"
|
||||
#include <cstdio>
|
||||
|
||||
using namespace clang;
|
||||
|
@ -54,10 +52,6 @@ IdentifierTable::IdentifierTable(const LangOptions &LangOpts,
|
|||
AddKeywords(LangOpts);
|
||||
}
|
||||
|
||||
// This cstor is intended to be used only for serialization.
|
||||
IdentifierTable::IdentifierTable()
|
||||
: HashTable(8192), ExternalLookup(0) { }
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Language Keyword Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -264,7 +258,6 @@ namespace clang {
|
|||
/// this class is provided strictly through Selector.
|
||||
class MultiKeywordSelector
|
||||
: public DeclarationNameExtra, public llvm::FoldingSetNode {
|
||||
friend SelectorTable* SelectorTable::CreateAndRegister(llvm::Deserializer&);
|
||||
MultiKeywordSelector(unsigned nKeys) {
|
||||
ExtraKindOrNumArgs = NUM_EXTRA_KINDS + nKeys;
|
||||
}
|
||||
|
@ -414,155 +407,3 @@ SelectorTable::~SelectorTable() {
|
|||
delete &getSelectorTableImpl(Impl);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Serialization for IdentifierInfo and IdentifierTable.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void IdentifierInfo::Emit(llvm::Serializer& S) const {
|
||||
S.EmitInt(getTokenID());
|
||||
S.EmitInt(getBuiltinID());
|
||||
S.EmitInt(getObjCKeywordID());
|
||||
S.EmitBool(hasMacroDefinition());
|
||||
S.EmitBool(isExtensionToken());
|
||||
S.EmitBool(isPoisoned());
|
||||
S.EmitBool(isCPlusPlusOperatorKeyword());
|
||||
// FIXME: FETokenInfo
|
||||
}
|
||||
|
||||
void IdentifierInfo::Read(llvm::Deserializer& D) {
|
||||
setTokenID((tok::TokenKind) D.ReadInt());
|
||||
setBuiltinID(D.ReadInt());
|
||||
setObjCKeywordID((tok::ObjCKeywordKind) D.ReadInt());
|
||||
setHasMacroDefinition(D.ReadBool());
|
||||
setIsExtensionToken(D.ReadBool());
|
||||
setIsPoisoned(D.ReadBool());
|
||||
setIsCPlusPlusOperatorKeyword(D.ReadBool());
|
||||
// FIXME: FETokenInfo
|
||||
}
|
||||
|
||||
void IdentifierTable::Emit(llvm::Serializer& S) const {
|
||||
S.EnterBlock();
|
||||
|
||||
S.EmitPtr(this);
|
||||
|
||||
for (iterator I=begin(), E=end(); I != E; ++I) {
|
||||
const char* Key = I->getKeyData();
|
||||
const IdentifierInfo* Info = I->getValue();
|
||||
|
||||
bool KeyRegistered = S.isRegistered(Key);
|
||||
bool InfoRegistered = S.isRegistered(Info);
|
||||
|
||||
if (KeyRegistered || InfoRegistered) {
|
||||
// These acrobatics are so that we don't incur the cost of registering
|
||||
// a pointer with the backpatcher during deserialization if nobody
|
||||
// references the object.
|
||||
S.EmitPtr(InfoRegistered ? Info : NULL);
|
||||
S.EmitPtr(KeyRegistered ? Key : NULL);
|
||||
S.EmitCStr(Key);
|
||||
S.Emit(*Info);
|
||||
}
|
||||
}
|
||||
|
||||
S.ExitBlock();
|
||||
}
|
||||
|
||||
IdentifierTable* IdentifierTable::CreateAndRegister(llvm::Deserializer& D) {
|
||||
llvm::Deserializer::Location BLoc = D.getCurrentBlockLocation();
|
||||
|
||||
std::vector<char> buff;
|
||||
buff.reserve(200);
|
||||
|
||||
IdentifierTable* t = new IdentifierTable();
|
||||
D.RegisterPtr(t);
|
||||
|
||||
while (!D.FinishedBlock(BLoc)) {
|
||||
llvm::SerializedPtrID InfoPtrID = D.ReadPtrID();
|
||||
llvm::SerializedPtrID KeyPtrID = D.ReadPtrID();
|
||||
|
||||
D.ReadCStr(buff);
|
||||
IdentifierInfo *II = &t->get(&buff[0], &buff[0] + buff.size());
|
||||
II->Read(D);
|
||||
|
||||
if (InfoPtrID) D.RegisterPtr(InfoPtrID, II);
|
||||
if (KeyPtrID) D.RegisterPtr(KeyPtrID, II->getName());
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Serialization for Selector and SelectorTable.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void Selector::Emit(llvm::Serializer& S) const {
|
||||
S.EmitInt(getIdentifierInfoFlag());
|
||||
S.EmitPtr(reinterpret_cast<void*>(InfoPtr & ~ArgFlags));
|
||||
}
|
||||
|
||||
Selector Selector::ReadVal(llvm::Deserializer& D) {
|
||||
unsigned flag = D.ReadInt();
|
||||
|
||||
uintptr_t ptr;
|
||||
D.ReadUIntPtr(ptr,false); // No backpatching.
|
||||
|
||||
return Selector(ptr | flag);
|
||||
}
|
||||
|
||||
void SelectorTable::Emit(llvm::Serializer& S) const {
|
||||
typedef llvm::FoldingSet<MultiKeywordSelector>::iterator iterator;
|
||||
llvm::FoldingSet<MultiKeywordSelector> *SelTab;
|
||||
SelTab = static_cast<llvm::FoldingSet<MultiKeywordSelector> *>(Impl);
|
||||
|
||||
S.EnterBlock();
|
||||
|
||||
S.EmitPtr(this);
|
||||
|
||||
for (iterator I=SelTab->begin(), E=SelTab->end(); I != E; ++I) {
|
||||
if (!S.isRegistered(&*I))
|
||||
continue;
|
||||
|
||||
S.FlushRecord(); // Start a new record.
|
||||
|
||||
S.EmitPtr(&*I);
|
||||
S.EmitInt(I->getNumArgs());
|
||||
|
||||
for (MultiKeywordSelector::keyword_iterator KI = I->keyword_begin(),
|
||||
KE = I->keyword_end(); KI != KE; ++KI)
|
||||
S.EmitPtr(*KI);
|
||||
}
|
||||
|
||||
S.ExitBlock();
|
||||
}
|
||||
|
||||
SelectorTable* SelectorTable::CreateAndRegister(llvm::Deserializer& D) {
|
||||
llvm::Deserializer::Location BLoc = D.getCurrentBlockLocation();
|
||||
|
||||
SelectorTable* t = new SelectorTable();
|
||||
D.RegisterPtr(t);
|
||||
|
||||
llvm::FoldingSet<MultiKeywordSelector>& SelTab =
|
||||
*static_cast<llvm::FoldingSet<MultiKeywordSelector>*>(t->Impl);
|
||||
|
||||
while (!D.FinishedBlock(BLoc)) {
|
||||
|
||||
llvm::SerializedPtrID PtrID = D.ReadPtrID();
|
||||
unsigned nKeys = D.ReadInt();
|
||||
|
||||
MultiKeywordSelector *SI =
|
||||
(MultiKeywordSelector*)malloc(sizeof(MultiKeywordSelector) +
|
||||
nKeys*sizeof(IdentifierInfo *));
|
||||
|
||||
new (SI) MultiKeywordSelector(nKeys);
|
||||
|
||||
D.RegisterPtr(PtrID,SI);
|
||||
|
||||
IdentifierInfo **KeyInfo = reinterpret_cast<IdentifierInfo **>(SI+1);
|
||||
|
||||
for (unsigned i = 0; i != nKeys; ++i)
|
||||
D.ReadPtr(KeyInfo[i],false);
|
||||
|
||||
SelTab.GetOrInsertNode(SI);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
//===--- LangOptions.cpp - Language feature info --------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the methods for LangOptions.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Basic/LangOptions.h"
|
||||
#include "llvm/Bitcode/Serialize.h"
|
||||
#include "llvm/Bitcode/Deserialize.h"
|
||||
|
||||
using namespace clang;
|
||||
|
||||
void LangOptions::Emit(llvm::Serializer& S) const {
|
||||
S.EmitBool((bool) Trigraphs);
|
||||
S.EmitBool((bool) BCPLComment);
|
||||
S.EmitBool((bool) DollarIdents);
|
||||
S.EmitBool((bool) Digraphs);
|
||||
S.EmitBool((bool) HexFloats);
|
||||
S.EmitBool((bool) C99);
|
||||
S.EmitBool((bool) Microsoft);
|
||||
S.EmitBool((bool) CPlusPlus);
|
||||
S.EmitBool((bool) CPlusPlus0x);
|
||||
S.EmitBool((bool) NoExtensions);
|
||||
S.EmitBool((bool) CXXOperatorNames);
|
||||
S.EmitBool((bool) ObjC1);
|
||||
S.EmitBool((bool) ObjC2);
|
||||
S.EmitBool((unsigned) GC);
|
||||
S.EmitBool((bool) PascalStrings);
|
||||
S.EmitBool((bool) Boolean);
|
||||
S.EmitBool((bool) WritableStrings);
|
||||
S.EmitBool((bool) LaxVectorConversions);
|
||||
}
|
||||
|
||||
void LangOptions::Read(llvm::Deserializer& D) {
|
||||
Trigraphs = D.ReadBool() ? 1 : 0;
|
||||
BCPLComment = D.ReadBool() ? 1 : 0;
|
||||
DollarIdents = D.ReadBool() ? 1 : 0;
|
||||
Digraphs = D.ReadBool() ? 1 : 0;
|
||||
HexFloats = D.ReadBool() ? 1 : 0;
|
||||
C99 = D.ReadBool() ? 1 : 0;
|
||||
Microsoft = D.ReadBool() ? 1 : 0;
|
||||
CPlusPlus = D.ReadBool() ? 1 : 0;
|
||||
CPlusPlus0x = D.ReadBool() ? 1 : 0;
|
||||
NoExtensions = D.ReadBool() ? 1 : 0;
|
||||
CXXOperatorNames = D.ReadBool() ? 1 : 0;
|
||||
ObjC1 = D.ReadBool() ? 1 : 0;
|
||||
ObjC2 = D.ReadBool() ? 1 : 0;
|
||||
GC = D.ReadInt();
|
||||
PascalStrings = D.ReadBool() ? 1 : 0;
|
||||
Boolean = D.ReadBool() ? 1 : 0;
|
||||
WritableStrings = D.ReadBool() ? 1 : 0;
|
||||
LaxVectorConversions = D.ReadBool() ? 1 : 0;
|
||||
}
|
|
@ -7,7 +7,6 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines serialization methods for the SourceLocation class.
|
||||
// This file defines accessor methods for the FullSourceLoc class.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -15,8 +14,6 @@
|
|||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "clang/Basic/PrettyStackTrace.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "llvm/Bitcode/Serialize.h"
|
||||
#include "llvm/Bitcode/Deserialize.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cstdio>
|
||||
|
@ -38,14 +35,6 @@ void PrettyStackTraceLoc::print(llvm::raw_ostream &OS) const {
|
|||
// SourceLocation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void SourceLocation::Emit(llvm::Serializer& S) const {
|
||||
S.EmitInt(getRawEncoding());
|
||||
}
|
||||
|
||||
SourceLocation SourceLocation::ReadVal(llvm::Deserializer& D) {
|
||||
return SourceLocation::getFromRawEncoding(D.ReadInt());
|
||||
}
|
||||
|
||||
void SourceLocation::print(llvm::raw_ostream &OS, const SourceManager &SM)const{
|
||||
if (!isValid()) {
|
||||
OS << "<invalid loc>";
|
||||
|
@ -71,17 +60,6 @@ void SourceLocation::dump(const SourceManager &SM) const {
|
|||
print(llvm::errs(), SM);
|
||||
}
|
||||
|
||||
void SourceRange::Emit(llvm::Serializer& S) const {
|
||||
B.Emit(S);
|
||||
E.Emit(S);
|
||||
}
|
||||
|
||||
SourceRange SourceRange::ReadVal(llvm::Deserializer& D) {
|
||||
SourceLocation A = SourceLocation::ReadVal(D);
|
||||
SourceLocation B = SourceLocation::ReadVal(D);
|
||||
return SourceRange(A,B);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// FullSourceLoc
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -17,10 +17,9 @@
|
|||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/System/Path.h"
|
||||
#include "llvm/Bitcode/Serialize.h"
|
||||
#include "llvm/Bitcode/Deserialize.h"
|
||||
#include "llvm/Support/Streams.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
using namespace clang;
|
||||
using namespace SrcMgr;
|
||||
using llvm::MemoryBuffer;
|
||||
|
@ -866,134 +865,3 @@ void SourceManager::PrintStats() const {
|
|||
llvm::cerr << "FileID scans: " << NumLinearScans << " linear, "
|
||||
<< NumBinaryProbes << " binary.\n";
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Serialization.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ContentCache::Emit(llvm::Serializer& S) const {
|
||||
S.FlushRecord();
|
||||
S.EmitPtr(this);
|
||||
|
||||
if (Entry) {
|
||||
llvm::sys::Path Fname(Buffer->getBufferIdentifier());
|
||||
|
||||
if (Fname.isAbsolute())
|
||||
S.EmitCStr(Fname.c_str());
|
||||
else {
|
||||
// Create an absolute path.
|
||||
// FIXME: This will potentially contain ".." and "." in the path.
|
||||
llvm::sys::Path path = llvm::sys::Path::GetCurrentDirectory();
|
||||
path.appendComponent(Fname.c_str());
|
||||
S.EmitCStr(path.c_str());
|
||||
}
|
||||
}
|
||||
else {
|
||||
const char* p = Buffer->getBufferStart();
|
||||
const char* e = Buffer->getBufferEnd();
|
||||
|
||||
S.EmitInt(e-p);
|
||||
|
||||
for ( ; p != e; ++p)
|
||||
S.EmitInt(*p);
|
||||
}
|
||||
|
||||
S.FlushRecord();
|
||||
}
|
||||
|
||||
void ContentCache::ReadToSourceManager(llvm::Deserializer& D,
|
||||
SourceManager& SMgr,
|
||||
FileManager* FMgr,
|
||||
std::vector<char>& Buf) {
|
||||
if (FMgr) {
|
||||
llvm::SerializedPtrID PtrID = D.ReadPtrID();
|
||||
D.ReadCStr(Buf,false);
|
||||
|
||||
// Create/fetch the FileEntry.
|
||||
const char* start = &Buf[0];
|
||||
const FileEntry* E = FMgr->getFile(start,start+Buf.size());
|
||||
|
||||
// FIXME: Ideally we want a lazy materialization of the ContentCache
|
||||
// anyway, because we don't want to read in source files unless this
|
||||
// is absolutely needed.
|
||||
if (!E)
|
||||
D.RegisterPtr(PtrID,NULL);
|
||||
else
|
||||
// Get the ContextCache object and register it with the deserializer.
|
||||
D.RegisterPtr(PtrID, SMgr.getOrCreateContentCache(E));
|
||||
return;
|
||||
}
|
||||
|
||||
// Register the ContextCache object with the deserializer.
|
||||
/* FIXME:
|
||||
ContentCache *Entry
|
||||
SMgr.MemBufferInfos.push_back(ContentCache());
|
||||
= const_cast<ContentCache&>(SMgr.MemBufferInfos.back());
|
||||
D.RegisterPtr(&Entry);
|
||||
|
||||
// Create the buffer.
|
||||
unsigned Size = D.ReadInt();
|
||||
Entry.Buffer = MemoryBuffer::getNewUninitMemBuffer(Size);
|
||||
|
||||
// Read the contents of the buffer.
|
||||
char* p = const_cast<char*>(Entry.Buffer->getBufferStart());
|
||||
for (unsigned i = 0; i < Size ; ++i)
|
||||
p[i] = D.ReadInt();
|
||||
*/
|
||||
}
|
||||
|
||||
void SourceManager::Emit(llvm::Serializer& S) const {
|
||||
S.EnterBlock();
|
||||
S.EmitPtr(this);
|
||||
S.EmitInt(MainFileID.getOpaqueValue());
|
||||
|
||||
// Emit: FileInfos. Just emit the file name.
|
||||
S.EnterBlock();
|
||||
|
||||
// FIXME: Emit FileInfos.
|
||||
//std::for_each(FileInfos.begin(), FileInfos.end(),
|
||||
// S.MakeEmitter<ContentCache>());
|
||||
|
||||
S.ExitBlock();
|
||||
|
||||
// Emit: MemBufferInfos
|
||||
S.EnterBlock();
|
||||
|
||||
/* FIXME: EMIT.
|
||||
std::for_each(MemBufferInfos.begin(), MemBufferInfos.end(),
|
||||
S.MakeEmitter<ContentCache>());
|
||||
*/
|
||||
|
||||
S.ExitBlock();
|
||||
|
||||
// FIXME: Emit SLocEntryTable.
|
||||
|
||||
S.ExitBlock();
|
||||
}
|
||||
|
||||
SourceManager*
|
||||
SourceManager::CreateAndRegister(llvm::Deserializer &D, FileManager &FMgr) {
|
||||
SourceManager *M = new SourceManager();
|
||||
D.RegisterPtr(M);
|
||||
|
||||
// Read: the FileID of the main source file of the translation unit.
|
||||
M->MainFileID = FileID::get(D.ReadInt());
|
||||
|
||||
std::vector<char> Buf;
|
||||
|
||||
/*{ // FIXME Read: FileInfos.
|
||||
llvm::Deserializer::Location BLoc = D.getCurrentBlockLocation();
|
||||
while (!D.FinishedBlock(BLoc))
|
||||
ContentCache::ReadToSourceManager(D,*M,&FMgr,Buf);
|
||||
}*/
|
||||
|
||||
/*{ // FIXME Read: MemBufferInfos.
|
||||
llvm::Deserializer::Location BLoc = D.getCurrentBlockLocation();
|
||||
while (!D.FinishedBlock(BLoc))
|
||||
ContentCache::ReadToSourceManager(D,*M,NULL,Buf);
|
||||
}*/
|
||||
|
||||
// FIXME: Read SLocEntryTable.
|
||||
|
||||
return M;
|
||||
}
|
||||
|
|
|
@ -1000,144 +1000,3 @@ public:
|
|||
ASTConsumer *clang::CreateInheritanceViewer(const std::string& clsname) {
|
||||
return new InheritanceViewer(clsname);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// AST Serializer
|
||||
|
||||
namespace {
|
||||
|
||||
class ASTSerializer : public ASTConsumer {
|
||||
protected:
|
||||
Diagnostic& Diags;
|
||||
|
||||
public:
|
||||
ASTSerializer(Diagnostic& diags) : Diags(diags) {}
|
||||
};
|
||||
|
||||
class SingleFileSerializer : public ASTSerializer {
|
||||
const llvm::sys::Path FName;
|
||||
public:
|
||||
SingleFileSerializer(const llvm::sys::Path& F, Diagnostic& diags)
|
||||
: ASTSerializer(diags), FName(F) {}
|
||||
|
||||
virtual void HandleTranslationUnit(ASTContext &Ctx) {
|
||||
if (Diags.hasErrorOccurred())
|
||||
return;
|
||||
|
||||
// Reserve 256K for bitstream buffer.
|
||||
std::vector<unsigned char> Buffer;
|
||||
Buffer.reserve(256*1024);
|
||||
|
||||
Ctx.EmitASTBitcodeBuffer(Buffer);
|
||||
|
||||
// Write the bits to disk.
|
||||
if (FILE* fp = fopen(FName.c_str(),"wb")) {
|
||||
fwrite((char*)&Buffer.front(), sizeof(char), Buffer.size(), fp);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class BuildSerializer : public ASTSerializer {
|
||||
llvm::sys::Path EmitDir;
|
||||
public:
|
||||
BuildSerializer(const llvm::sys::Path& dir, Diagnostic& diags)
|
||||
: ASTSerializer(diags), EmitDir(dir) {}
|
||||
|
||||
virtual void HandleTranslationUnit(ASTContext &Ctx);
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
|
||||
void BuildSerializer::HandleTranslationUnit(ASTContext &Ctx) {
|
||||
if (Diags.hasErrorOccurred())
|
||||
return;
|
||||
|
||||
SourceManager& SourceMgr = Ctx.getSourceManager();
|
||||
FileID ID = SourceMgr.getMainFileID();
|
||||
assert(!ID.isInvalid() && "MainFileID not set!");
|
||||
const FileEntry* FE = SourceMgr.getFileEntryForID(ID);
|
||||
assert(FE && "No FileEntry for main file.");
|
||||
|
||||
// FIXME: This is not portable to Windows.
|
||||
// FIXME: This logic should probably be moved elsewhere later.
|
||||
|
||||
llvm::sys::Path FName(EmitDir);
|
||||
|
||||
std::vector<char> buf;
|
||||
buf.reserve(strlen(FE->getName())+100);
|
||||
|
||||
sprintf(&buf[0], "dev_%llx", (unsigned long long) FE->getDevice());
|
||||
FName.appendComponent(&buf[0]);
|
||||
FName.createDirectoryOnDisk(true);
|
||||
if (!FName.canWrite() || !FName.isDirectory()) {
|
||||
assert (false && "Could not create 'device' serialization directory.");
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(&buf[0], "%s-%llX.ast", FE->getName(),
|
||||
(unsigned long long) FE->getInode());
|
||||
FName.appendComponent(&buf[0]);
|
||||
|
||||
|
||||
// Reserve 256K for bitstream buffer.
|
||||
std::vector<unsigned char> Buffer;
|
||||
Buffer.reserve(256*1024);
|
||||
|
||||
Ctx.EmitASTBitcodeBuffer(Buffer);
|
||||
|
||||
// Write the bits to disk.
|
||||
if (FILE* fp = fopen(FName.c_str(),"wb")) {
|
||||
fwrite((char*)&Buffer.front(), sizeof(char), Buffer.size(), fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
// Now emit the sources.
|
||||
|
||||
}
|
||||
|
||||
|
||||
ASTConsumer* clang::CreateASTSerializer(const std::string& InFile,
|
||||
const std::string& OutputFile,
|
||||
Diagnostic &Diags) {
|
||||
|
||||
if (OutputFile.size()) {
|
||||
if (InFile == "-") {
|
||||
llvm::cerr <<
|
||||
"error: Cannot use --serialize with -o for source read from STDIN.\n";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// The user specified an AST-emission directory. Determine if the path
|
||||
// is absolute.
|
||||
llvm::sys::Path EmitDir(OutputFile);
|
||||
|
||||
if (!EmitDir.isAbsolute()) {
|
||||
llvm::cerr <<
|
||||
"error: Output directory for --serialize must be an absolute path.\n";
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Create the directory if it does not exist.
|
||||
EmitDir.createDirectoryOnDisk(true);
|
||||
if (!EmitDir.canWrite() || !EmitDir.isDirectory()) {
|
||||
llvm::cerr <<
|
||||
"error: Could not create output directory for --serialize.\n";
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// FIXME: We should probably only allow using BuildSerializer when
|
||||
// the ASTs come from parsed source files, and not from .ast files.
|
||||
return new BuildSerializer(EmitDir, Diags);
|
||||
}
|
||||
|
||||
// The user did not specify an output directory for serialized ASTs.
|
||||
// Serialize the translation to a single file whose name is the same
|
||||
// as the input file with the ".ast" extension appended.
|
||||
|
||||
llvm::sys::Path FName(InFile.c_str());
|
||||
FName.appendSuffix("ast");
|
||||
return new SingleFileSerializer(FName, Diags);
|
||||
}
|
||||
|
|
|
@ -61,13 +61,6 @@ ASTConsumer *CreateBackendConsumer(BackendAction Action,
|
|||
ASTConsumer* CreateHTMLPrinter(const std::string &OutFile, Diagnostic &D,
|
||||
Preprocessor *PP, PreprocessorFactory *PPF);
|
||||
|
||||
ASTConsumer *CreateSerializationTest(Diagnostic &Diags,
|
||||
FileManager &FMgr);
|
||||
|
||||
ASTConsumer *CreateASTSerializer(const std::string &InFile,
|
||||
const std::string &EmitDir,
|
||||
Diagnostic &Diags);
|
||||
|
||||
ASTConsumer *CreatePCHGenerator(const Preprocessor &PP,
|
||||
const std::string &OutFile);
|
||||
|
||||
|
|
|
@ -37,6 +37,5 @@ add_clang_executable(clang-cc
|
|||
RewriteMacros.cpp
|
||||
RewriteObjC.cpp
|
||||
RewriteTest.cpp
|
||||
SerializationTest.cpp
|
||||
Warnings.cpp
|
||||
)
|
||||
|
|
|
@ -1,226 +0,0 @@
|
|||
//===--- SerializationTest.cpp - Experimental Object Serialization --------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements prototype code for serialization of objects in clang.
|
||||
// It is not intended yet for public use, but simply is a placeholder to
|
||||
// experiment with new serialization features. Serialization will eventually
|
||||
// be integrated as a proper component of the clang libraries.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/AST/ASTConsumer.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/CFG.h"
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/DeclGroup.h"
|
||||
#include "clang-cc.h"
|
||||
#include "ASTConsumers.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/Support/Streams.h"
|
||||
#include "llvm/System/Path.h"
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
using namespace clang;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Driver code.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace {
|
||||
|
||||
class SerializationTest : public ASTConsumer {
|
||||
Diagnostic &Diags;
|
||||
FileManager &FMgr;
|
||||
public:
|
||||
SerializationTest(Diagnostic &d, FileManager& fmgr)
|
||||
: Diags(d), FMgr(fmgr) {}
|
||||
|
||||
~SerializationTest() {}
|
||||
|
||||
virtual void HandleTranslationUnit(ASTContext &C);
|
||||
|
||||
private:
|
||||
bool Serialize(llvm::sys::Path& Filename, llvm::sys::Path& FNameDeclPrint,
|
||||
ASTContext &Ctx);
|
||||
|
||||
bool Deserialize(llvm::sys::Path& Filename, llvm::sys::Path& FNameDeclPrint);
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
ASTConsumer*
|
||||
clang::CreateSerializationTest(Diagnostic &Diags, FileManager& FMgr) {
|
||||
return new SerializationTest(Diags, FMgr);
|
||||
}
|
||||
|
||||
|
||||
bool SerializationTest::Serialize(llvm::sys::Path& Filename,
|
||||
llvm::sys::Path& FNameDeclPrint,
|
||||
ASTContext &Ctx) {
|
||||
{
|
||||
// Pretty-print the decls to a temp file.
|
||||
std::string Err;
|
||||
llvm::raw_fd_ostream DeclPP(FNameDeclPrint.c_str(), true, Err);
|
||||
assert (Err.empty() && "Could not open file for printing out decls.");
|
||||
llvm::OwningPtr<ASTConsumer> FilePrinter(CreateASTPrinter(&DeclPP));
|
||||
|
||||
TranslationUnitDecl *TUD = Ctx.getTranslationUnitDecl();
|
||||
for (DeclContext::decl_iterator I = TUD->decls_begin(Ctx),
|
||||
E = TUD->decls_end(Ctx);
|
||||
I != E; ++I)
|
||||
FilePrinter->HandleTopLevelDecl(DeclGroupRef(*I));
|
||||
}
|
||||
|
||||
// Serialize the translation unit.
|
||||
|
||||
// Reserve 256K for bitstream buffer.
|
||||
std::vector<unsigned char> Buffer;
|
||||
Buffer.reserve(256*1024);
|
||||
|
||||
Ctx.EmitASTBitcodeBuffer(Buffer);
|
||||
|
||||
// Write the bits to disk.
|
||||
if (FILE* fp = fopen(Filename.c_str(),"wb")) {
|
||||
fwrite((char*)&Buffer.front(), sizeof(char), Buffer.size(), fp);
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SerializationTest::Deserialize(llvm::sys::Path& Filename,
|
||||
llvm::sys::Path& FNameDeclPrint) {
|
||||
|
||||
// Deserialize the translation unit.
|
||||
ASTContext *NewCtx;
|
||||
|
||||
{
|
||||
// Create the memory buffer that contains the contents of the file.
|
||||
llvm::OwningPtr<llvm::MemoryBuffer>
|
||||
MBuffer(llvm::MemoryBuffer::getFile(Filename.c_str()));
|
||||
|
||||
if (!MBuffer)
|
||||
return false;
|
||||
|
||||
NewCtx = ASTContext::ReadASTBitcodeBuffer(*MBuffer, FMgr);
|
||||
}
|
||||
|
||||
if (!NewCtx)
|
||||
return false;
|
||||
|
||||
{
|
||||
// Pretty-print the deserialized decls to a temp file.
|
||||
std::string Err;
|
||||
llvm::raw_fd_ostream DeclPP(FNameDeclPrint.c_str(), true, Err);
|
||||
assert (Err.empty() && "Could not open file for printing out decls.");
|
||||
llvm::OwningPtr<ASTConsumer> FilePrinter(CreateASTPrinter(&DeclPP));
|
||||
|
||||
TranslationUnitDecl *TUD = NewCtx->getTranslationUnitDecl();
|
||||
for (DeclContext::decl_iterator I = TUD->decls_begin(*NewCtx),
|
||||
E = TUD->decls_end(*NewCtx);
|
||||
I != E; ++I)
|
||||
FilePrinter->HandleTopLevelDecl(DeclGroupRef(*I));
|
||||
}
|
||||
|
||||
delete NewCtx;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace {
|
||||
class TmpDirJanitor {
|
||||
llvm::sys::Path& Dir;
|
||||
public:
|
||||
explicit TmpDirJanitor(llvm::sys::Path& dir) : Dir(dir) {}
|
||||
|
||||
~TmpDirJanitor() {
|
||||
llvm::cerr << "Removing: " << Dir.c_str() << '\n';
|
||||
Dir.eraseFromDisk(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void SerializationTest::HandleTranslationUnit(ASTContext &Ctx) {
|
||||
|
||||
std::string ErrMsg;
|
||||
llvm::sys::Path Dir = llvm::sys::Path::GetTemporaryDirectory(&ErrMsg);
|
||||
|
||||
if (Dir.isEmpty()) {
|
||||
llvm::cerr << "Error: " << ErrMsg << "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
TmpDirJanitor RemoveTmpOnExit(Dir);
|
||||
|
||||
llvm::sys::Path FNameDeclBefore = Dir;
|
||||
FNameDeclBefore.appendComponent("test.decl_before.txt");
|
||||
|
||||
if (FNameDeclBefore.makeUnique(true, &ErrMsg)) {
|
||||
llvm::cerr << "Error: " << ErrMsg << "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
llvm::sys::Path FNameDeclAfter = Dir;
|
||||
FNameDeclAfter.appendComponent("test.decl_after.txt");
|
||||
|
||||
if (FNameDeclAfter.makeUnique(true, &ErrMsg)) {
|
||||
llvm::cerr << "Error: " << ErrMsg << "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
llvm::sys::Path ASTFilename = Dir;
|
||||
ASTFilename.appendComponent("test.ast");
|
||||
|
||||
if (ASTFilename.makeUnique(true, &ErrMsg)) {
|
||||
llvm::cerr << "Error: " << ErrMsg << "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
// Serialize and then deserialize the ASTs.
|
||||
bool status = Serialize(ASTFilename, FNameDeclBefore, Ctx);
|
||||
assert (status && "Serialization failed.");
|
||||
status = Deserialize(ASTFilename, FNameDeclAfter);
|
||||
assert (status && "Deserialization failed.");
|
||||
|
||||
// Read both pretty-printed files and compare them.
|
||||
|
||||
using llvm::MemoryBuffer;
|
||||
|
||||
llvm::OwningPtr<MemoryBuffer>
|
||||
MBufferSer(MemoryBuffer::getFile(FNameDeclBefore.c_str()));
|
||||
|
||||
if(!MBufferSer) {
|
||||
llvm::cerr << "ERROR: Cannot read pretty-printed file (pre-pickle).\n";
|
||||
return;
|
||||
}
|
||||
|
||||
llvm::OwningPtr<MemoryBuffer>
|
||||
MBufferDSer(MemoryBuffer::getFile(FNameDeclAfter.c_str()));
|
||||
|
||||
if(!MBufferDSer) {
|
||||
llvm::cerr << "ERROR: Cannot read pretty-printed file (post-pickle).\n";
|
||||
return;
|
||||
}
|
||||
|
||||
const char *p1 = MBufferSer->getBufferStart();
|
||||
const char *e1 = MBufferSer->getBufferEnd();
|
||||
const char *p2 = MBufferDSer->getBufferStart();
|
||||
const char *e2 = MBufferDSer->getBufferEnd();
|
||||
|
||||
if (MBufferSer->getBufferSize() == MBufferDSer->getBufferSize())
|
||||
for ( ; p1 != e1 ; ++p1, ++p2 )
|
||||
if (*p1 != *p2) break;
|
||||
|
||||
if (p1 != e1 || p2 != e2 )
|
||||
llvm::cerr << "ERROR: Pretty-printed files are not the same.\n";
|
||||
else
|
||||
llvm::cerr << "SUCCESS: Pretty-printed files are the same.\n";
|
||||
}
|
|
@ -180,13 +180,11 @@ enum ProgActions {
|
|||
EmitLLVM, // Emit a .ll file.
|
||||
EmitBC, // Emit a .bc file.
|
||||
EmitLLVMOnly, // Generate LLVM IR, but do not
|
||||
SerializeAST, // Emit a .ast file.
|
||||
EmitHTML, // Translate input source into HTML.
|
||||
ASTPrint, // Parse ASTs and print them.
|
||||
ASTDump, // Parse ASTs and dump them.
|
||||
ASTView, // Parse ASTs and view them in Graphviz.
|
||||
PrintDeclContext, // Print DeclContext and their Decls.
|
||||
TestSerialization, // Run experimental serialization code.
|
||||
ParsePrintCallbacks, // Parse and print each callback.
|
||||
ParseSyntaxOnly, // Parse and perform semantic analysis.
|
||||
ParseNoop, // Parse with noop callbacks.
|
||||
|
@ -234,8 +232,6 @@ ProgAction(llvm::cl::desc("Choose output type:"), llvm::cl::ZeroOrMore,
|
|||
"Generate pre-tokenized header file"),
|
||||
clEnumValN(GeneratePCH, "emit-pch",
|
||||
"Generate pre-compiled header file"),
|
||||
clEnumValN(TestSerialization, "test-pickling",
|
||||
"Run prototype serialization code"),
|
||||
clEnumValN(EmitAssembly, "S",
|
||||
"Emit native assembly code"),
|
||||
clEnumValN(EmitLLVM, "emit-llvm",
|
||||
|
@ -244,8 +240,6 @@ ProgAction(llvm::cl::desc("Choose output type:"), llvm::cl::ZeroOrMore,
|
|||
"Build ASTs then convert to LLVM, emit .bc file"),
|
||||
clEnumValN(EmitLLVMOnly, "emit-llvm-only",
|
||||
"Build ASTs and convert to LLVM, discarding output"),
|
||||
clEnumValN(SerializeAST, "serialize",
|
||||
"Build ASTs and emit .ast file"),
|
||||
clEnumValN(RewriteTest, "rewrite-test",
|
||||
"Rewriter playground"),
|
||||
clEnumValN(RewriteObjC, "rewrite-objc",
|
||||
|
@ -262,7 +256,7 @@ ProgAction(llvm::cl::desc("Choose output type:"), llvm::cl::ZeroOrMore,
|
|||
static llvm::cl::opt<std::string>
|
||||
OutputFile("o",
|
||||
llvm::cl::value_desc("path"),
|
||||
llvm::cl::desc("Specify output file (for --serialize, this is a directory)"));
|
||||
llvm::cl::desc("Specify output file"));
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -1559,9 +1553,6 @@ static ASTConsumer *CreateASTConsumer(const std::string& InFile,
|
|||
case InheritanceView:
|
||||
return CreateInheritanceViewer(InheritanceViewCls);
|
||||
|
||||
case TestSerialization:
|
||||
return CreateSerializationTest(Diag, FileMgr);
|
||||
|
||||
case EmitAssembly:
|
||||
case EmitLLVM:
|
||||
case EmitBC:
|
||||
|
@ -1582,12 +1573,7 @@ static ASTConsumer *CreateASTConsumer(const std::string& InFile,
|
|||
InFile, OutputFile);
|
||||
}
|
||||
|
||||
case SerializeAST:
|
||||
// FIXME: Allow user to tailor where the file is written.
|
||||
return CreateASTSerializer(InFile, OutputFile, Diag);
|
||||
|
||||
case GeneratePCH:
|
||||
assert(PP && "Generate PCH doesn't work from serialized file yet");
|
||||
return CreatePCHGenerator(*PP, OutputFile);
|
||||
|
||||
case RewriteObjC:
|
||||
|
@ -1841,70 +1827,9 @@ static void ProcessInputFile(Preprocessor &PP, PreprocessorFactory &PPF,
|
|||
Consumer.take();
|
||||
}
|
||||
|
||||
static void ProcessSerializedFile(const std::string& InFile, Diagnostic& Diag,
|
||||
FileManager& FileMgr) {
|
||||
|
||||
if (VerifyDiagnostics) {
|
||||
fprintf(stderr, "-verify does not yet work with serialized ASTs.\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
llvm::sys::Path Filename(InFile);
|
||||
|
||||
if (!Filename.isValid()) {
|
||||
fprintf(stderr, "serialized file '%s' not available.\n",InFile.c_str());
|
||||
exit (1);
|
||||
}
|
||||
|
||||
llvm::OwningPtr<ASTContext> Ctx;
|
||||
|
||||
// Create the memory buffer that contains the contents of the file.
|
||||
llvm::OwningPtr<llvm::MemoryBuffer>
|
||||
MBuffer(llvm::MemoryBuffer::getFile(Filename.c_str()));
|
||||
|
||||
if (MBuffer)
|
||||
Ctx.reset(ASTContext::ReadASTBitcodeBuffer(*MBuffer, FileMgr));
|
||||
|
||||
if (!Ctx) {
|
||||
fprintf(stderr, "error: file '%s' could not be deserialized\n",
|
||||
InFile.c_str());
|
||||
exit (1);
|
||||
}
|
||||
|
||||
// Observe that we use the source file name stored in the deserialized
|
||||
// translation unit, rather than InFile.
|
||||
llvm::OwningPtr<ASTConsumer>
|
||||
Consumer(CreateASTConsumer(InFile, Diag, FileMgr, Ctx->getLangOptions(),
|
||||
0, 0));
|
||||
|
||||
if (!Consumer) {
|
||||
fprintf(stderr, "Unsupported program action with serialized ASTs!\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
Consumer->Initialize(*Ctx);
|
||||
|
||||
// FIXME: We need to inform Consumer about completed TagDecls as well.
|
||||
TranslationUnitDecl *TUD = Ctx->getTranslationUnitDecl();
|
||||
for (DeclContext::decl_iterator I = TUD->decls_begin(*Ctx),
|
||||
E = TUD->decls_end(*Ctx);
|
||||
I != E; ++I)
|
||||
Consumer->HandleTopLevelDecl(DeclGroupRef(*I));
|
||||
}
|
||||
|
||||
|
||||
static llvm::cl::list<std::string>
|
||||
InputFilenames(llvm::cl::Positional, llvm::cl::desc("<input files>"));
|
||||
|
||||
static bool isSerializedFile(const std::string& InFile) {
|
||||
if (InFile.size() < 4)
|
||||
return false;
|
||||
|
||||
const char* s = InFile.c_str()+InFile.size()-4;
|
||||
return s[0] == '.' && s[1] == 'a' && s[2] == 's' && s[3] == 't';
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
llvm::sys::PrintStackTraceOnErrorSignal();
|
||||
llvm::PrettyStackTraceProgram X(argc, argv);
|
||||
|
@ -1991,11 +1916,6 @@ int main(int argc, char **argv) {
|
|||
for (unsigned i = 0, e = InputFilenames.size(); i != e; ++i) {
|
||||
const std::string &InFile = InputFilenames[i];
|
||||
|
||||
if (isSerializedFile(InFile)) {
|
||||
ProcessSerializedFile(InFile,Diags,FileMgr);
|
||||
continue;
|
||||
}
|
||||
|
||||
/// Create a SourceManager object. This tracks and owns all the file
|
||||
/// buffers allocated to a translation unit.
|
||||
if (!SourceMgr)
|
||||
|
|
Загрузка…
Ссылка в новой задаче