[cfe-commits] r69828 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ lib/AST/ lib/Basic/ test/Serialization/ tools/clang-cc/
Douglas Gregor
dgregor at apple.com
Wed Apr 22 14:45:53 PDT 2009
Author: dgregor
Date: Wed Apr 22 16:45:53 2009
New Revision: 69828
URL: http://llvm.org/viewvc/llvm-project?rev=69828&view=rev
Log:
Remove the serialization code that predates precompiled
headers. Future approaches to (de-)serializing ASTs will be based on
the PCH infrastructure.
Removed:
cfe/trunk/lib/AST/DeclSerialization.cpp
cfe/trunk/lib/AST/StmtSerialization.cpp
cfe/trunk/lib/AST/TypeSerialization.cpp
cfe/trunk/lib/Basic/LangOptions.cpp
cfe/trunk/test/Serialization/
cfe/trunk/tools/clang-cc/SerializationTest.cpp
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/include/clang/AST/DeclGroup.h
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/include/clang/AST/DeclarationName.h
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/AST/ExprObjC.h
cfe/trunk/include/clang/AST/Stmt.h
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/include/clang/Basic/FileManager.h
cfe/trunk/include/clang/Basic/IdentifierTable.h
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/include/clang/Basic/SourceLocation.h
cfe/trunk/include/clang/Basic/SourceManager.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/CMakeLists.txt
cfe/trunk/lib/AST/DeclGroup.cpp
cfe/trunk/lib/AST/DeclarationName.cpp
cfe/trunk/lib/Basic/CMakeLists.txt
cfe/trunk/lib/Basic/FileManager.cpp
cfe/trunk/lib/Basic/IdentifierTable.cpp
cfe/trunk/lib/Basic/SourceLocation.cpp
cfe/trunk/lib/Basic/SourceManager.cpp
cfe/trunk/tools/clang-cc/ASTConsumers.cpp
cfe/trunk/tools/clang-cc/ASTConsumers.h
cfe/trunk/tools/clang-cc/CMakeLists.txt
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Wed Apr 22 16:45:53 2009
@@ -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 @@
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.
@@ -700,17 +694,6 @@
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
//===--------------------------------------------------------------------===//
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Wed Apr 22 16:45:53 2009
@@ -25,10 +25,6 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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
Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Wed Apr 22 16:45:53 2009
@@ -297,22 +297,9 @@
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 @@
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 {
Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Wed Apr 22 16:45:53 2009
@@ -44,7 +44,11 @@
/// 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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:
Modified: cfe/trunk/include/clang/AST/DeclGroup.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclGroup.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclGroup.h (original)
+++ cfe/trunk/include/clang/AST/DeclGroup.h Wed Apr 22 16:45:53 2009
@@ -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 @@
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 @@
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
Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Wed Apr 22 16:45:53 2009
@@ -271,15 +271,6 @@
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 @@
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 @@
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
Modified: cfe/trunk/include/clang/AST/DeclarationName.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclarationName.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclarationName.h (original)
+++ cfe/trunk/include/clang/AST/DeclarationName.h Wed Apr 22 16:45:53 2009
@@ -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;
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Wed Apr 22 16:45:53 2009
@@ -294,10 +294,6 @@
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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
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 @@
// 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 @@
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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
// 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 @@
// 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 @@
// 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
Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Wed Apr 22 16:45:53 2009
@@ -129,10 +129,6 @@
}
}
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 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
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
Modified: cfe/trunk/include/clang/AST/ExprObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprObjC.h (original)
+++ cfe/trunk/include/clang/AST/ExprObjC.h Wed Apr 22 16:45:53 2009
@@ -53,9 +53,6 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
// 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
Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Wed Apr 22 16:45:53 2009
@@ -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 @@
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 @@
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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Wed Apr 22 16:45:53 2009
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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
Modified: cfe/trunk/include/clang/Basic/FileManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileManager.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/FileManager.h (original)
+++ cfe/trunk/include/clang/Basic/FileManager.h Wed Apr 22 16:45:53 2009
@@ -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>
Modified: cfe/trunk/include/clang/Basic/IdentifierTable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/IdentifierTable.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/IdentifierTable.h (original)
+++ cfe/trunk/include/clang/Basic/IdentifierTable.h Wed Apr 22 16:45:53 2009
@@ -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 @@
/// 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 @@
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 @@
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 @@
&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,
Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Wed Apr 22 16:45:53 2009
@@ -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 @@
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
Modified: cfe/trunk/include/clang/Basic/SourceLocation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceLocation.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/SourceLocation.h (original)
+++ cfe/trunk/include/clang/Basic/SourceLocation.h Wed Apr 22 16:45:53 2009
@@ -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 @@
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 @@
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
Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Wed Apr 22 16:45:53 2009
@@ -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 @@
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 @@
///
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 @@
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 {
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Apr 22 16:45:53 2009
@@ -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 @@
}
}
-
-//===----------------------------------------------------------------------===//
-// 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() { }
Modified: cfe/trunk/lib/AST/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CMakeLists.txt?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CMakeLists.txt (original)
+++ cfe/trunk/lib/AST/CMakeLists.txt Wed Apr 22 16:45:53 2009
@@ -12,7 +12,6 @@
DeclCXX.cpp
DeclGroup.cpp
DeclObjC.cpp
- DeclSerialization.cpp
DeclTemplate.cpp
ExprConstant.cpp
Expr.cpp
@@ -24,11 +23,9 @@
StmtDumper.cpp
StmtIterator.cpp
StmtPrinter.cpp
- StmtSerialization.cpp
StmtViz.cpp
TemplateName.cpp
Type.cpp
- TypeSerialization.cpp
)
add_dependencies(clangAST ClangDiagnosticAST)
Modified: cfe/trunk/lib/AST/DeclGroup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclGroup.cpp?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclGroup.cpp (original)
+++ cfe/trunk/lib/AST/DeclGroup.cpp Wed Apr 22 16:45:53 2009
@@ -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 @@
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 @@
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>());
-}
Removed: cfe/trunk/lib/AST/DeclSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclSerialization.cpp?rev=69827&view=auto
==============================================================================
--- cfe/trunk/lib/AST/DeclSerialization.cpp (original)
+++ cfe/trunk/lib/AST/DeclSerialization.cpp (removed)
@@ -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;
-}
Modified: cfe/trunk/lib/AST/DeclarationName.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclarationName.cpp?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclarationName.cpp (original)
+++ cfe/trunk/lib/AST/DeclarationName.cpp Wed Apr 22 16:45:53 2009
@@ -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 {
Removed: cfe/trunk/lib/AST/StmtSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtSerialization.cpp?rev=69827&view=auto
==============================================================================
--- cfe/trunk/lib/AST/StmtSerialization.cpp (original)
+++ cfe/trunk/lib/AST/StmtSerialization.cpp (removed)
@@ -1,1602 +0,0 @@
-//===--- StmtSerialization.cpp - Serialization of Statements --------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the type-specific methods for serializing statements
-// and expressions.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Basic/TypeTraits.h"
-#include "clang/AST/DeclCXX.h"
-#include "clang/AST/Expr.h"
-#include "clang/AST/ExprCXX.h"
-#include "clang/AST/ExprObjC.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;
-
-void Stmt::Emit(Serializer& S) const {
- S.FlushRecord();
- S.EmitInt(getStmtClass());
- EmitImpl(S);
- S.FlushRecord();
-}
-
-Stmt* Stmt::Create(Deserializer& D, ASTContext& C) {
- StmtClass SC = static_cast<StmtClass>(D.ReadInt());
-
- switch (SC) {
- default:
- assert (false && "Not implemented.");
- return NULL;
-
- case AddrLabelExprClass:
- return AddrLabelExpr::CreateImpl(D, C);
-
- case ArraySubscriptExprClass:
- return ArraySubscriptExpr::CreateImpl(D, C);
-
- case AsmStmtClass:
- return AsmStmt::CreateImpl(D, C);
-
- case BinaryOperatorClass:
- return BinaryOperator::CreateImpl(D, C);
-
- case BreakStmtClass:
- return BreakStmt::CreateImpl(D, C);
-
- case CallExprClass:
- return CallExpr::CreateImpl(D, C, CallExprClass);
-
- case CaseStmtClass:
- return CaseStmt::CreateImpl(D, C);
-
- case CharacterLiteralClass:
- return CharacterLiteral::CreateImpl(D, C);
-
- case ChooseExprClass:
- return ChooseExpr::CreateImpl(D, C);
-
- case CompoundAssignOperatorClass:
- return CompoundAssignOperator::CreateImpl(D, C);
-
- case CompoundLiteralExprClass:
- return CompoundLiteralExpr::CreateImpl(D, C);
-
- case CompoundStmtClass:
- return CompoundStmt::CreateImpl(D, C);
-
- case ConditionalOperatorClass:
- return ConditionalOperator::CreateImpl(D, C);
-
- case ContinueStmtClass:
- return ContinueStmt::CreateImpl(D, C);
-
- case DeclRefExprClass:
- return DeclRefExpr::CreateImpl(D, C);
-
- case DeclStmtClass:
- return DeclStmt::CreateImpl(D, C);
-
- case DefaultStmtClass:
- return DefaultStmt::CreateImpl(D, C);
-
- case DoStmtClass:
- return DoStmt::CreateImpl(D, C);
-
- case FloatingLiteralClass:
- return FloatingLiteral::CreateImpl(D, C);
-
- case ForStmtClass:
- return ForStmt::CreateImpl(D, C);
-
- case GNUNullExprClass:
- return GNUNullExpr::CreateImpl(D, C);
-
- case GotoStmtClass:
- return GotoStmt::CreateImpl(D, C);
-
- case IfStmtClass:
- return IfStmt::CreateImpl(D, C);
-
- case ImaginaryLiteralClass:
- return ImaginaryLiteral::CreateImpl(D, C);
-
- case ImplicitCastExprClass:
- return ImplicitCastExpr::CreateImpl(D, C);
-
- case CStyleCastExprClass:
- return CStyleCastExpr::CreateImpl(D, C);
-
- case IndirectGotoStmtClass:
- return IndirectGotoStmt::CreateImpl(D, C);
-
- case InitListExprClass:
- return InitListExpr::CreateImpl(D, C);
-
- case IntegerLiteralClass:
- return IntegerLiteral::CreateImpl(D, C);
-
- case LabelStmtClass:
- return LabelStmt::CreateImpl(D, C);
-
- case MemberExprClass:
- return MemberExpr::CreateImpl(D, C);
-
- case NullStmtClass:
- return NullStmt::CreateImpl(D, C);
-
- case ParenExprClass:
- return ParenExpr::CreateImpl(D, C);
-
- case PredefinedExprClass:
- return PredefinedExpr::CreateImpl(D, C);
-
- case ReturnStmtClass:
- return ReturnStmt::CreateImpl(D, C);
-
- case SizeOfAlignOfExprClass:
- return SizeOfAlignOfExpr::CreateImpl(D, C);
-
- case StmtExprClass:
- return StmtExpr::CreateImpl(D, C);
-
- case StringLiteralClass:
- return StringLiteral::CreateImpl(D, C);
-
- case SwitchStmtClass:
- return SwitchStmt::CreateImpl(D, C);
-
- case UnaryOperatorClass:
- return UnaryOperator::CreateImpl(D, C);
-
- case WhileStmtClass:
- return WhileStmt::CreateImpl(D, C);
-
- //==--------------------------------------==//
- // Objective C
- //==--------------------------------------==//
-
- case ObjCAtCatchStmtClass:
- return ObjCAtCatchStmt::CreateImpl(D, C);
-
- case ObjCAtFinallyStmtClass:
- return ObjCAtFinallyStmt::CreateImpl(D, C);
-
- case ObjCAtSynchronizedStmtClass:
- return ObjCAtSynchronizedStmt::CreateImpl(D, C);
-
- case ObjCAtThrowStmtClass:
- return ObjCAtThrowStmt::CreateImpl(D, C);
-
- case ObjCAtTryStmtClass:
- return ObjCAtTryStmt::CreateImpl(D, C);
-
- case ObjCEncodeExprClass:
- return ObjCEncodeExpr::CreateImpl(D, C);
-
- case ObjCForCollectionStmtClass:
- return ObjCForCollectionStmt::CreateImpl(D, C);
-
- case ObjCIvarRefExprClass:
- return ObjCIvarRefExpr::CreateImpl(D, C);
-
- case ObjCMessageExprClass:
- return ObjCMessageExpr::CreateImpl(D, C);
-
- case ObjCSelectorExprClass:
- return ObjCSelectorExpr::CreateImpl(D, C);
-
- case ObjCStringLiteralClass:
- return ObjCStringLiteral::CreateImpl(D, C);
-
- case ObjCSuperExprClass:
- return ObjCSuperExpr::CreateImpl(D, C);
-
- //==--------------------------------------==//
- // C++
- //==--------------------------------------==//
-
- case CXXOperatorCallExprClass:
- return CXXOperatorCallExpr::CreateImpl(D, C, CXXOperatorCallExprClass);
-
- case CXXDefaultArgExprClass:
- return CXXDefaultArgExpr::CreateImpl(D, C);
-
- case CXXFunctionalCastExprClass:
- return CXXFunctionalCastExpr::CreateImpl(D, C);
-
- case CXXStaticCastExprClass:
- return CXXStaticCastExpr::CreateImpl(D, C, SC);
-
- case CXXDynamicCastExprClass:
- return CXXDynamicCastExpr::CreateImpl(D, C, SC);
-
- case CXXReinterpretCastExprClass:
- return CXXReinterpretCastExpr::CreateImpl(D, C, SC);
-
- case CXXConstCastExprClass:
- return CXXConstCastExpr::CreateImpl(D, C, SC);
-
- case CXXTypeidExprClass:
- return CXXTypeidExpr::CreateImpl(D, C);
-
- case CXXThisExprClass:
- return CXXThisExpr::CreateImpl(D, C);
-
- case CXXTemporaryObjectExprClass:
- return CXXTemporaryObjectExpr::CreateImpl(D, C);
-
- case CXXZeroInitValueExprClass:
- return CXXZeroInitValueExpr::CreateImpl(D, C);
-
- case CXXNewExprClass:
- return CXXNewExpr::CreateImpl(D, C);
-
- case CXXDeleteExprClass:
- return CXXDeleteExpr::CreateImpl(D, C);
-
- case UnresolvedFunctionNameExprClass:
- return UnresolvedFunctionNameExpr::CreateImpl(D, C);
-
- case CXXCatchStmtClass:
- return CXXCatchStmt::CreateImpl(D, C);
-
- case CXXTryStmtClass:
- return CXXTryStmt::CreateImpl(D, C);
-
- case QualifiedDeclRefExprClass:
- return QualifiedDeclRefExpr::CreateImpl(D, C);
- }
-}
-
-//===----------------------------------------------------------------------===//
-// C Serialization
-//===----------------------------------------------------------------------===//
-
-void AddrLabelExpr::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.Emit(AmpAmpLoc);
- S.Emit(LabelLoc);
- S.EmitPtr(Label);
-}
-
-AddrLabelExpr* AddrLabelExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType t = QualType::ReadVal(D);
- SourceLocation AALoc = SourceLocation::ReadVal(D);
- SourceLocation LLoc = SourceLocation::ReadVal(D);
- AddrLabelExpr* expr = new (C, llvm::alignof<AddrLabelExpr>())
- AddrLabelExpr(AALoc,LLoc,NULL,t);
- D.ReadPtr(expr->Label); // Pointer may be backpatched.
- return expr;
-}
-
-void ArraySubscriptExpr::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.Emit(RBracketLoc);
- S.BatchEmitOwnedPtrs(getLHS(),getRHS());
-}
-
-ArraySubscriptExpr* ArraySubscriptExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType t = QualType::ReadVal(D);
- SourceLocation L = SourceLocation::ReadVal(D);
- Expr *LHS, *RHS;
- D.BatchReadOwnedPtrs(LHS, RHS, C);
- return new (C, llvm::alignof<ArraySubscriptExpr>())
- ArraySubscriptExpr(LHS,RHS,t,L);
-}
-
-void AsmStmt::EmitImpl(Serializer& S) const {
- S.Emit(AsmLoc);
-
- getAsmString()->EmitImpl(S);
- S.Emit(RParenLoc);
-
- S.EmitBool(IsVolatile);
- S.EmitBool(IsSimple);
- S.EmitInt(NumOutputs);
- S.EmitInt(NumInputs);
-
- unsigned size = NumOutputs + NumInputs;
-
- for (unsigned i = 0; i < size; ++i)
- S.EmitCStr(Names[i].c_str());
-
- for (unsigned i = 0; i < size; ++i)
- Constraints[i]->EmitImpl(S);
-
- for (unsigned i = 0; i < size; ++i)
- S.EmitOwnedPtr(Exprs[i]);
-
- S.EmitInt(Clobbers.size());
- for (unsigned i = 0, e = Clobbers.size(); i != e; ++i)
- Clobbers[i]->EmitImpl(S);
-}
-
-AsmStmt* AsmStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation ALoc = SourceLocation::ReadVal(D);
- StringLiteral *AsmStr = StringLiteral::CreateImpl(D, C);
- SourceLocation PLoc = SourceLocation::ReadVal(D);
-
- bool IsVolatile = D.ReadBool();
- bool IsSimple = D.ReadBool();
- AsmStmt *Stmt = new (C, llvm::alignof<AsmStmt>())
- AsmStmt(ALoc, IsSimple, IsVolatile, 0, 0, 0, 0, 0, AsmStr, 0, 0, PLoc);
-
- Stmt->NumOutputs = D.ReadInt();
- Stmt->NumInputs = D.ReadInt();
-
- unsigned size = Stmt->NumOutputs + Stmt->NumInputs;
-
- Stmt->Names.reserve(size);
- for (unsigned i = 0; i < size; ++i) {
- std::vector<char> data;
- D.ReadCStr(data, false);
-
- Stmt->Names.push_back(std::string(data.begin(), data.end()));
- }
-
- Stmt->Constraints.reserve(size);
- for (unsigned i = 0; i < size; ++i)
- Stmt->Constraints.push_back(StringLiteral::CreateImpl(D, C));
-
- Stmt->Exprs.reserve(size);
- for (unsigned i = 0; i < size; ++i)
- Stmt->Exprs.push_back(D.ReadOwnedPtr<Expr>(C));
-
- unsigned NumClobbers = D.ReadInt();
- Stmt->Clobbers.reserve(NumClobbers);
- for (unsigned i = 0; i < NumClobbers; ++i)
- Stmt->Clobbers.push_back(StringLiteral::CreateImpl(D, C));
-
- return Stmt;
-}
-
-void BinaryOperator::EmitImpl(Serializer& S) const {
- S.EmitInt(Opc);
- S.Emit(OpLoc);;
- S.Emit(getType());
- S.BatchEmitOwnedPtrs(getLHS(),getRHS());
-}
-
-BinaryOperator* BinaryOperator::CreateImpl(Deserializer& D, ASTContext& C) {
- Opcode Opc = static_cast<Opcode>(D.ReadInt());
- SourceLocation OpLoc = SourceLocation::ReadVal(D);
- QualType Result = QualType::ReadVal(D);
- Expr *LHS, *RHS;
- D.BatchReadOwnedPtrs(LHS, RHS, C);
-
- return new (C, llvm::alignof<BinaryOperator>())
- BinaryOperator(LHS,RHS,Opc,Result,OpLoc);
-}
-
-void BreakStmt::EmitImpl(Serializer& S) const {
- S.Emit(BreakLoc);
-}
-
-BreakStmt* BreakStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation Loc = SourceLocation::ReadVal(D);
- return new (C, llvm::alignof<BreakStmt>()) BreakStmt(Loc);
-}
-
-void CallExpr::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.Emit(RParenLoc);
- S.EmitInt(NumArgs);
- S.BatchEmitOwnedPtrs(NumArgs+1, SubExprs);
-}
-
-CallExpr* CallExpr::CreateImpl(Deserializer& D, ASTContext& C, StmtClass SC) {
- QualType t = QualType::ReadVal(D);
- SourceLocation L = SourceLocation::ReadVal(D);
- unsigned NumArgs = D.ReadInt();
- Stmt** SubExprs = new (C, llvm::alignof<Stmt*>()) Stmt*[NumArgs+1];
- D.BatchReadOwnedPtrs(NumArgs+1, SubExprs, C);
- return new (C, llvm::alignof<CallExpr>()) CallExpr(SC, SubExprs,NumArgs,t,L);
-}
-
-void CaseStmt::EmitImpl(Serializer& S) const {
- S.Emit(CaseLoc);
- S.EmitPtr(getNextSwitchCase());
- S.BatchEmitOwnedPtrs((unsigned) END_EXPR,&SubExprs[0]);
-}
-
-CaseStmt* CaseStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation CaseLoc = SourceLocation::ReadVal(D);
- CaseStmt* stmt = new (C, llvm::alignof<CaseStmt>())
- CaseStmt(NULL,NULL,CaseLoc);
- D.ReadPtr(stmt->NextSwitchCase);
- D.BatchReadOwnedPtrs((unsigned) END_EXPR, &stmt->SubExprs[0], C);
- return stmt;
-}
-
-void CStyleCastExpr::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.Emit(getTypeAsWritten());
- S.Emit(LPLoc);
- S.Emit(RPLoc);
- S.EmitOwnedPtr(getSubExpr());
-}
-
-CStyleCastExpr* CStyleCastExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType t = QualType::ReadVal(D);
- QualType writtenTy = QualType::ReadVal(D);
- SourceLocation LPLoc = SourceLocation::ReadVal(D);
- SourceLocation RPLoc = SourceLocation::ReadVal(D);
- Expr* Op = D.ReadOwnedPtr<Expr>(C);
- return new (C, llvm::alignof<CStyleCastExpr>())
- CStyleCastExpr(t,Op,writtenTy,LPLoc,RPLoc);
-}
-
-void CharacterLiteral::EmitImpl(Serializer& S) const {
- S.Emit(Value);
- S.Emit(Loc);
- S.EmitBool(IsWide);
- S.Emit(getType());
-}
-
-CharacterLiteral* CharacterLiteral::CreateImpl(Deserializer& D, ASTContext& C) {
- unsigned value = D.ReadInt();
- SourceLocation Loc = SourceLocation::ReadVal(D);
- bool iswide = D.ReadBool();
- QualType T = QualType::ReadVal(D);
- return new (C, llvm::alignof<CharacterLiteral>())
- CharacterLiteral(value,iswide,T,Loc);
-}
-
-void CompoundAssignOperator::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.Emit(ComputationLHSType);
- S.Emit(ComputationResultType);
- S.Emit(getOperatorLoc());
- S.EmitInt(getOpcode());
- S.BatchEmitOwnedPtrs(getLHS(),getRHS());
-}
-
-CompoundAssignOperator*
-CompoundAssignOperator::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType t = QualType::ReadVal(D);
- QualType cl = QualType::ReadVal(D);
- QualType cr = QualType::ReadVal(D);
- SourceLocation L = SourceLocation::ReadVal(D);
- Opcode Opc = static_cast<Opcode>(D.ReadInt());
- Expr* LHS, *RHS;
- D.BatchReadOwnedPtrs(LHS, RHS, C);
-
- return new (C, llvm::alignof<CompoundAssignOperator>())
- CompoundAssignOperator(LHS,RHS,Opc,t,cl,cr,L);
-}
-
-void CompoundLiteralExpr::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.Emit(getLParenLoc());
- S.EmitBool(isFileScope());
- S.EmitOwnedPtr(Init);
-}
-
-CompoundLiteralExpr* CompoundLiteralExpr::CreateImpl(Deserializer& D,
- ASTContext& C) {
- QualType Q = QualType::ReadVal(D);
- SourceLocation L = SourceLocation::ReadVal(D);
- bool fileScope = D.ReadBool();
- Expr* Init = D.ReadOwnedPtr<Expr>(C);
- return new (C, llvm::alignof<CompoundLiteralExpr>())
- CompoundLiteralExpr(L, Q, Init, fileScope);
-}
-
-void CompoundStmt::EmitImpl(Serializer& S) const {
- S.Emit(LBracLoc);
- S.Emit(RBracLoc);
- S.Emit(NumStmts);
- if (NumStmts) S.BatchEmitOwnedPtrs(NumStmts, &Body[0]);
-}
-
-CompoundStmt* CompoundStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation LB = SourceLocation::ReadVal(D);
- SourceLocation RB = SourceLocation::ReadVal(D);
- unsigned size = D.ReadInt();
-
- CompoundStmt* stmt = new (C, llvm::alignof<CompoundStmt>())
- CompoundStmt(C, NULL, 0, LB, RB);
-
- stmt->NumStmts = size;
-
- if (size) {
- stmt->Body = new (C) Stmt*[size];
- D.BatchReadOwnedPtrs(size, &stmt->Body[0], C);
- }
-
- return stmt;
-}
-
-void ConditionalOperator::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.BatchEmitOwnedPtrs((unsigned) END_EXPR, SubExprs);
-}
-
-ConditionalOperator* ConditionalOperator::CreateImpl(Deserializer& D,
- ASTContext& C) {
-
- QualType t = QualType::ReadVal(D);
- ConditionalOperator* c = new (C, llvm::alignof<ConditionalOperator>())
- ConditionalOperator(NULL,NULL,NULL,t);
- D.BatchReadOwnedPtrs((unsigned) END_EXPR, c->SubExprs, C);
- return c;
-}
-
-void ContinueStmt::EmitImpl(Serializer& S) const {
- S.Emit(ContinueLoc);
-}
-
-ContinueStmt* ContinueStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation Loc = SourceLocation::ReadVal(D);
- return new ContinueStmt(Loc);
-}
-
-void DeclStmt::EmitImpl(Serializer& S) const {
- S.Emit(StartLoc);
- S.Emit(EndLoc);
- S.Emit(DG);
-}
-
-DeclStmt* DeclStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation StartLoc = SourceLocation::ReadVal(D);
- SourceLocation EndLoc = SourceLocation::ReadVal(D);
- return new DeclStmt(DeclGroupRef::ReadVal(D), StartLoc, EndLoc);
-}
-
-void DeclRefExpr::EmitImpl(Serializer& S) const {
- S.Emit(Loc);
- S.Emit(getType());
- S.EmitPtr(getDecl());
-}
-
-DeclRefExpr* DeclRefExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation Loc = SourceLocation::ReadVal(D);
- QualType T = QualType::ReadVal(D);
- DeclRefExpr *DRE = new DeclRefExpr(0, T, Loc);
- D.ReadPtr(DRE->D);
- return DRE;
-}
-
-void DefaultStmt::EmitImpl(Serializer& S) const {
- S.Emit(DefaultLoc);
- S.EmitOwnedPtr(getSubStmt());
- S.EmitPtr(getNextSwitchCase());
-}
-
-DefaultStmt* DefaultStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation Loc = SourceLocation::ReadVal(D);
- Stmt* SubStmt = D.ReadOwnedPtr<Stmt>(C);
-
- DefaultStmt* stmt = new DefaultStmt(Loc,SubStmt);
- stmt->setNextSwitchCase(D.ReadPtr<SwitchCase>());
-
- return stmt;
-}
-
-void DoStmt::EmitImpl(Serializer& S) const {
- S.Emit(DoLoc);
- S.EmitOwnedPtr(getCond());
- S.EmitOwnedPtr(getBody());
-}
-
-DoStmt* DoStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation DoLoc = SourceLocation::ReadVal(D);
- Expr* Cond = D.ReadOwnedPtr<Expr>(C);
- Stmt* Body = D.ReadOwnedPtr<Stmt>(C);
- return new DoStmt(Body,Cond,DoLoc);
-}
-
-void FloatingLiteral::EmitImpl(Serializer& S) const {
- S.Emit(Loc);
- S.Emit(getType());
- S.EmitBool(isExact());
- S.Emit(Value);
-}
-
-FloatingLiteral* FloatingLiteral::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation Loc = SourceLocation::ReadVal(D);
- QualType t = QualType::ReadVal(D);
- bool isExact = D.ReadBool();
- llvm::APFloat Val = llvm::APFloat::ReadVal(D);
- FloatingLiteral* expr = new FloatingLiteral(Val,&isExact,t,Loc);
- return expr;
-}
-
-void ForStmt::EmitImpl(Serializer& S) const {
- S.Emit(ForLoc);
- S.EmitOwnedPtr(getInit());
- S.EmitOwnedPtr(getCond());
- S.EmitOwnedPtr(getInc());
- S.EmitOwnedPtr(getBody());
-}
-
-ForStmt* ForStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation ForLoc = SourceLocation::ReadVal(D);
- Stmt* Init = D.ReadOwnedPtr<Stmt>(C);
- Expr* Cond = D.ReadOwnedPtr<Expr>(C);
- Expr* Inc = D.ReadOwnedPtr<Expr>(C);
- Stmt* Body = D.ReadOwnedPtr<Stmt>(C);
- return new ForStmt(Init,Cond,Inc,Body,ForLoc);
-}
-
-void GotoStmt::EmitImpl(Serializer& S) const {
- S.Emit(GotoLoc);
- S.Emit(LabelLoc);
- S.EmitPtr(Label);
-}
-
-GotoStmt* GotoStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation GotoLoc = SourceLocation::ReadVal(D);
- SourceLocation LabelLoc = SourceLocation::ReadVal(D);
- GotoStmt* stmt = new GotoStmt(NULL,GotoLoc,LabelLoc);
- D.ReadPtr(stmt->Label); // This pointer may be backpatched later.
- return stmt;
-}
-
-void IfStmt::EmitImpl(Serializer& S) const {
- S.Emit(IfLoc);
- S.EmitOwnedPtr(getCond());
- S.EmitOwnedPtr(getThen());
- S.EmitOwnedPtr(getElse());
-}
-
-IfStmt* IfStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation L = SourceLocation::ReadVal(D);
- Expr* Cond = D.ReadOwnedPtr<Expr>(C);
- Stmt* Then = D.ReadOwnedPtr<Stmt>(C);
- Stmt* Else = D.ReadOwnedPtr<Stmt>(C);
- return new IfStmt(L,Cond,Then,Else);
-}
-
-void ImaginaryLiteral::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.EmitOwnedPtr(Val);
-}
-
-ImaginaryLiteral* ImaginaryLiteral::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType t = QualType::ReadVal(D);
- Expr* expr = D.ReadOwnedPtr<Expr>(C);
- assert (isa<FloatingLiteral>(expr) || isa<IntegerLiteral>(expr));
- return new ImaginaryLiteral(expr,t);
-}
-
-void ImplicitCastExpr::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.EmitOwnedPtr(getSubExpr());
- S.Emit(LvalueCast);
-}
-
-ImplicitCastExpr* ImplicitCastExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType t = QualType::ReadVal(D);
- Expr* Op = D.ReadOwnedPtr<Expr>(C);
- bool isLvalue = D.ReadBool();
- return new ImplicitCastExpr(t,Op,isLvalue);
-}
-
-void IndirectGotoStmt::EmitImpl(Serializer& S) const {
- S.EmitOwnedPtr(Target);
-}
-
-IndirectGotoStmt* IndirectGotoStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- Expr* Target = D.ReadOwnedPtr<Expr>(C);
- return new IndirectGotoStmt(SourceLocation(), Target);
-}
-
-void InitListExpr::EmitImpl(Serializer& S) const {
- S.Emit(LBraceLoc);
- S.Emit(RBraceLoc);
- S.EmitInt(InitExprs.size());
- if (!InitExprs.empty()) S.BatchEmitOwnedPtrs(InitExprs.size(), &InitExprs[0]);
-}
-
-InitListExpr* InitListExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- InitListExpr* expr = new InitListExpr();
- expr->LBraceLoc = SourceLocation::ReadVal(D);
- expr->RBraceLoc = SourceLocation::ReadVal(D);
- unsigned size = D.ReadInt();
- assert(size);
- expr->InitExprs.reserve(size);
- for (unsigned i = 0 ; i < size; ++i) expr->InitExprs.push_back(0);
-
- D.BatchReadOwnedPtrs(size, &expr->InitExprs[0], C);
- return expr;
-}
-
-void IntegerLiteral::EmitImpl(Serializer& S) const {
- S.Emit(Loc);
- S.Emit(getType());
- S.Emit(getValue());
-}
-
-IntegerLiteral* IntegerLiteral::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation Loc = SourceLocation::ReadVal(D);
- QualType T = QualType::ReadVal(D);
-
- // Create a dummy APInt because it is more efficient to deserialize
- // it in place with the deserialized IntegerLiteral. (fewer copies)
- llvm::APInt temp;
- IntegerLiteral* expr = new IntegerLiteral(temp,T,Loc);
- D.Read(expr->Value);
-
- return expr;
-}
-
-void LabelStmt::EmitImpl(Serializer& S) const {
- S.EmitPtr(Label);
- S.Emit(IdentLoc);
- S.EmitOwnedPtr(SubStmt);
-}
-
-LabelStmt* LabelStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- IdentifierInfo* Label = D.ReadPtr<IdentifierInfo>();
- SourceLocation IdentLoc = SourceLocation::ReadVal(D);
- Stmt* SubStmt = D.ReadOwnedPtr<Stmt>(C);
- return new LabelStmt(IdentLoc,Label,SubStmt);
-}
-
-void MemberExpr::EmitImpl(Serializer& S) const {
- S.Emit(MemberLoc);
- S.EmitPtr(MemberDecl);
- S.EmitBool(IsArrow);
- S.Emit(getType());
- S.EmitOwnedPtr(Base);
-}
-
-MemberExpr* MemberExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation L = SourceLocation::ReadVal(D);
- NamedDecl* MemberDecl = cast<NamedDecl>(D.ReadPtr<Decl>());
- bool IsArrow = D.ReadBool();
- QualType T = QualType::ReadVal(D);
- Expr* base = D.ReadOwnedPtr<Expr>(C);
-
- return new MemberExpr(base,IsArrow,MemberDecl,L,T);
-}
-
-void NullStmt::EmitImpl(Serializer& S) const {
- S.Emit(SemiLoc);
-}
-
-NullStmt* NullStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation SemiLoc = SourceLocation::ReadVal(D);
- return new NullStmt(SemiLoc);
-}
-
-void ParenExpr::EmitImpl(Serializer& S) const {
- S.Emit(L);
- S.Emit(R);
- S.EmitOwnedPtr(Val);
-}
-
-ParenExpr* ParenExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation L = SourceLocation::ReadVal(D);
- SourceLocation R = SourceLocation::ReadVal(D);
- Expr* val = D.ReadOwnedPtr<Expr>(C);
- return new ParenExpr(L,R,val);
-}
-
-void PredefinedExpr::EmitImpl(Serializer& S) const {
- S.Emit(Loc);
- S.EmitInt(getIdentType());
- S.Emit(getType());
-}
-
-PredefinedExpr* PredefinedExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation Loc = SourceLocation::ReadVal(D);
- IdentType it = static_cast<IdentType>(D.ReadInt());
- QualType Q = QualType::ReadVal(D);
- return new PredefinedExpr(Loc,Q,it);
-}
-
-void ReturnStmt::EmitImpl(Serializer& S) const {
- S.Emit(RetLoc);
- S.EmitOwnedPtr(RetExpr);
-}
-
-ReturnStmt* ReturnStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation RetLoc = SourceLocation::ReadVal(D);
- Expr* RetExpr = D.ReadOwnedPtr<Expr>(C);
- return new ReturnStmt(RetLoc,RetExpr);
-}
-
-void SizeOfAlignOfExpr::EmitImpl(Serializer& S) const {
- S.EmitBool(isSizeof);
- S.EmitBool(isType);
- if (isType)
- S.Emit(getArgumentType());
- else
- S.EmitOwnedPtr(getArgumentExpr());
- S.Emit(getType());
- S.Emit(OpLoc);
- S.Emit(RParenLoc);
-}
-
-SizeOfAlignOfExpr*
-SizeOfAlignOfExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- bool isSizeof = D.ReadBool();
- bool isType = D.ReadBool();
- void *Argument;
- if (isType)
- Argument = QualType::ReadVal(D).getAsOpaquePtr();
- else
- Argument = D.ReadOwnedPtr<Expr>(C);
- QualType Res = QualType::ReadVal(D);
- SourceLocation OpLoc = SourceLocation::ReadVal(D);
- SourceLocation RParenLoc = SourceLocation::ReadVal(D);
-
- if (isType)
- return new (C) SizeOfAlignOfExpr(isSizeof,
- QualType::getFromOpaquePtr(Argument),
- Res, OpLoc, RParenLoc);
-
- return new (C) SizeOfAlignOfExpr(isSizeof, (Expr *)Argument,
- Res, OpLoc, RParenLoc);
-}
-
-void StmtExpr::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.Emit(LParenLoc);
- S.Emit(RParenLoc);
- S.EmitOwnedPtr(SubStmt);
-}
-
-StmtExpr* StmtExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType t = QualType::ReadVal(D);
- SourceLocation L = SourceLocation::ReadVal(D);
- SourceLocation R = SourceLocation::ReadVal(D);
- CompoundStmt* SubStmt = cast<CompoundStmt>(D.ReadOwnedPtr<Stmt>(C));
- return new StmtExpr(SubStmt,t,L,R);
-}
-
-void TypesCompatibleExpr::EmitImpl(llvm::Serializer& S) const {
- S.Emit(getType());
- S.Emit(BuiltinLoc);
- S.Emit(RParenLoc);
- S.Emit(Type1);
- S.Emit(Type2);
-}
-
-TypesCompatibleExpr* TypesCompatibleExpr::CreateImpl(llvm::Deserializer& D,
- ASTContext& C) {
- QualType RT = QualType::ReadVal(D);
- SourceLocation BL = SourceLocation::ReadVal(D);
- SourceLocation RP = SourceLocation::ReadVal(D);
- QualType T1 = QualType::ReadVal(D);
- QualType T2 = QualType::ReadVal(D);
- return new TypesCompatibleExpr(RT, BL, T1, T2, RP);
-}
-
-void ShuffleVectorExpr::EmitImpl(llvm::Serializer& S) const {
- S.Emit(getType());
- S.Emit(BuiltinLoc);
- S.Emit(RParenLoc);
- S.EmitInt(NumExprs);
- S.BatchEmitOwnedPtrs(NumExprs, &SubExprs[0]);
-}
-
-ShuffleVectorExpr* ShuffleVectorExpr::CreateImpl(llvm::Deserializer& D,
- ASTContext& C) {
- QualType T = QualType::ReadVal(D);
- SourceLocation BL = SourceLocation::ReadVal(D);
- SourceLocation RP = SourceLocation::ReadVal(D);
- unsigned NumExprs = D.ReadInt();
- // FIXME: Avoid extra allocation.
- llvm::SmallVector<Expr*, 4> Exprs(NumExprs);
- D.BatchReadOwnedPtrs(NumExprs, Exprs.begin(), C);
- return new ShuffleVectorExpr(Exprs.begin(), NumExprs, T, BL, RP);
-}
-
-void ChooseExpr::EmitImpl(llvm::Serializer& S) const {
- S.Emit(getType());
- S.Emit(BuiltinLoc);
- S.Emit(RParenLoc);
- S.BatchEmitOwnedPtrs((unsigned) END_EXPR, &SubExprs[0]);
-}
-
-ChooseExpr* ChooseExpr::CreateImpl(llvm::Deserializer& D, ASTContext& C) {
- QualType T = QualType::ReadVal(D);
- SourceLocation BL = SourceLocation::ReadVal(D);
- SourceLocation RP = SourceLocation::ReadVal(D);
- ChooseExpr *CE = new ChooseExpr(BL, 0, 0, 0, T, RP);
- D.BatchReadOwnedPtrs((unsigned) END_EXPR, &CE->SubExprs[0], C);
- return CE;
-}
-
-void GNUNullExpr::EmitImpl(llvm::Serializer &S) const {
- S.Emit(getType());
- S.Emit(TokenLoc);
-}
-
-GNUNullExpr *GNUNullExpr::CreateImpl(llvm::Deserializer &D, ASTContext &C) {
- QualType T = QualType::ReadVal(D);
- SourceLocation TL = SourceLocation::ReadVal(D);
- return new GNUNullExpr(T, TL);
-}
-
-void VAArgExpr::EmitImpl(llvm::Serializer& S) const {
- S.Emit(getType());
- S.Emit(BuiltinLoc);
- S.Emit(RParenLoc);
- S.EmitOwnedPtr(getSubExpr());
-}
-
-VAArgExpr* VAArgExpr::CreateImpl(llvm::Deserializer& D, ASTContext& C) {
- QualType T = QualType::ReadVal(D);
- SourceLocation BL = SourceLocation::ReadVal(D);
- SourceLocation RP = SourceLocation::ReadVal(D);
- Expr *E = D.ReadOwnedPtr<Expr>(C);
- return new VAArgExpr(BL, E, T, RP);
-}
-
-void StringLiteral::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- assert(0 && "Unimpl loc serialization");
- S.EmitBool(isWide());
- S.Emit(getByteLength());
-
- for (unsigned i = 0 ; i < ByteLength; ++i)
- S.EmitInt(StrData[i]);
-}
-
-StringLiteral* StringLiteral::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType t = QualType::ReadVal(D);
- assert(0 && "Unimpl loc serialization");
- //SourceLocation firstTokLoc = SourceLocation::ReadVal(D);
- //SourceLocation lastTokLoc = SourceLocation::ReadVal(D);
- bool isWide = D.ReadBool();
- unsigned ByteLength = D.ReadInt();
-
- StringLiteral* sl = StringLiteral::Create(C, NULL, 0, isWide, t,
- SourceLocation());
-
- char* StrData = new (C, llvm::alignof<char>()) char[ByteLength];
- for (unsigned i = 0; i < ByteLength; ++i)
- StrData[i] = (char) D.ReadInt();
-
- sl->ByteLength = ByteLength;
- sl->StrData = StrData;
-
- return sl;
-}
-
-void SwitchStmt::EmitImpl(Serializer& S) const {
- S.Emit(SwitchLoc);
- S.EmitOwnedPtr(getCond());
- S.EmitOwnedPtr(getBody());
- S.EmitPtr(FirstCase);
-}
-
-SwitchStmt* SwitchStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation Loc = SourceLocation::ReadVal(D);
- Stmt* Cond = D.ReadOwnedPtr<Stmt>(C);
- Stmt* Body = D.ReadOwnedPtr<Stmt>(C);
- SwitchCase* FirstCase = cast<SwitchCase>(D.ReadPtr<Stmt>());
-
- SwitchStmt* stmt = new SwitchStmt(cast<Expr>(Cond));
- stmt->setBody(Body,Loc);
- stmt->FirstCase = FirstCase;
-
- return stmt;
-}
-
-void UnaryOperator::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.Emit(Loc);
- S.EmitInt(Opc);
- S.EmitOwnedPtr(Val);
-}
-
-UnaryOperator* UnaryOperator::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType t = QualType::ReadVal(D);
- SourceLocation L = SourceLocation::ReadVal(D);
- Opcode Opc = static_cast<Opcode>(D.ReadInt());
- Expr* Val = D.ReadOwnedPtr<Expr>(C);
- return new UnaryOperator(Val,Opc,t,L);
-}
-
-void WhileStmt::EmitImpl(Serializer& S) const {
- S.Emit(WhileLoc);
- S.EmitOwnedPtr(getCond());
- S.EmitOwnedPtr(getBody());
-}
-
-WhileStmt* WhileStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation WhileLoc = SourceLocation::ReadVal(D);
- Expr* Cond = D.ReadOwnedPtr<Expr>(C);
- Stmt* Body = D.ReadOwnedPtr<Stmt>(C);
- return new WhileStmt(Cond,Body,WhileLoc);
-}
-
-//===----------------------------------------------------------------------===//
-// Objective C Serialization
-//===----------------------------------------------------------------------===//
-
-void ObjCAtCatchStmt::EmitImpl(Serializer& S) const {
- S.Emit(AtCatchLoc);
- S.Emit(RParenLoc);
- S.BatchEmitOwnedPtrs((unsigned) END_EXPR, &SubExprs[0]);
-}
-
-ObjCAtCatchStmt* ObjCAtCatchStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation AtCatchLoc = SourceLocation::ReadVal(D);
- SourceLocation RParenLoc = SourceLocation::ReadVal(D);
-
- ObjCAtCatchStmt* stmt = new ObjCAtCatchStmt(AtCatchLoc,RParenLoc);
- D.BatchReadOwnedPtrs((unsigned) END_EXPR, &stmt->SubExprs[0], C);
-
- return stmt;
-}
-
-void ObjCAtFinallyStmt::EmitImpl(Serializer& S) const {
- S.Emit(AtFinallyLoc);
- S.EmitOwnedPtr(AtFinallyStmt);
-}
-
-ObjCAtFinallyStmt* ObjCAtFinallyStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation Loc = SourceLocation::ReadVal(D);
- Stmt* AtFinallyStmt = D.ReadOwnedPtr<Stmt>(C);
- return new ObjCAtFinallyStmt(Loc,AtFinallyStmt);
-}
-
-void ObjCAtSynchronizedStmt::EmitImpl(Serializer& S) const {
- S.Emit(AtSynchronizedLoc);
- S.BatchEmitOwnedPtrs((unsigned) END_EXPR,&SubStmts[0]);
- }
-
-ObjCAtSynchronizedStmt* ObjCAtSynchronizedStmt::CreateImpl(Deserializer& D,
- ASTContext& C) {
-
- SourceLocation L = SourceLocation::ReadVal(D);
- ObjCAtSynchronizedStmt* stmt = new ObjCAtSynchronizedStmt(L,0,0);
- D.BatchReadOwnedPtrs((unsigned) END_EXPR, &stmt->SubStmts[0], C);
- return stmt;
-}
-
-void ObjCAtThrowStmt::EmitImpl(Serializer& S) const {
- S.Emit(AtThrowLoc);
- S.EmitOwnedPtr(Throw);
-}
-
-ObjCAtThrowStmt* ObjCAtThrowStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation L = SourceLocation::ReadVal(D);
- Stmt* Throw = D.ReadOwnedPtr<Stmt>(C);
- return new ObjCAtThrowStmt(L,Throw);
-}
-
-void ObjCAtTryStmt::EmitImpl(Serializer& S) const {
- S.Emit(AtTryLoc);
- S.BatchEmitOwnedPtrs((unsigned) END_EXPR, &SubStmts[0]);
-}
-
-ObjCAtTryStmt* ObjCAtTryStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation L = SourceLocation::ReadVal(D);
- ObjCAtTryStmt* stmt = new ObjCAtTryStmt(L,NULL,NULL,NULL);
- D.BatchReadOwnedPtrs((unsigned) END_EXPR, &stmt->SubStmts[0], C);
- return stmt;
-}
-
-void ObjCEncodeExpr::EmitImpl(Serializer& S) const {
- S.Emit(AtLoc);
- S.Emit(RParenLoc);
- S.Emit(getType());
- S.Emit(EncType);
-}
-
-ObjCEncodeExpr* ObjCEncodeExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation AtLoc = SourceLocation::ReadVal(D);
- SourceLocation RParenLoc = SourceLocation::ReadVal(D);
- QualType T = QualType::ReadVal(D);
- QualType ET = QualType::ReadVal(D);
- return new ObjCEncodeExpr(T,ET,AtLoc,RParenLoc);
-}
-
-void ObjCForCollectionStmt::EmitImpl(Serializer& S) const {
- S.Emit(ForLoc);
- S.Emit(RParenLoc);
- S.BatchEmitOwnedPtrs(getElement(),getCollection(),getBody());
-}
-
-ObjCForCollectionStmt* ObjCForCollectionStmt::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation ForLoc = SourceLocation::ReadVal(D);
- SourceLocation RParenLoc = SourceLocation::ReadVal(D);
- Stmt* Element;
- Expr* Collection;
- Stmt* Body;
- D.BatchReadOwnedPtrs(Element, Collection, Body, C);
- return new ObjCForCollectionStmt(Element,Collection,Body,ForLoc, RParenLoc);
-}
-
-void ObjCProtocolExpr::EmitImpl(llvm::Serializer& S) const {
- S.Emit(getType());
- S.EmitPtr(Protocol);
- S.Emit(AtLoc);
- S.Emit(RParenLoc);
-}
-
-ObjCProtocolExpr* ObjCProtocolExpr::CreateImpl(llvm::Deserializer& D,
- ASTContext& C) {
- QualType T = QualType::ReadVal(D);
- ObjCProtocolDecl *PD = D.ReadPtr<ObjCProtocolDecl>();
- SourceLocation AL = SourceLocation::ReadVal(D);
- SourceLocation RP = SourceLocation::ReadVal(D);
- return new ObjCProtocolExpr(T, PD, AL, RP);
-}
-
-void ObjCIvarRefExpr::EmitImpl(Serializer& S) const {
- S.Emit(Loc);
- S.Emit(getType());
- S.EmitPtr(getDecl());
-}
-
-ObjCIvarRefExpr* ObjCIvarRefExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation Loc = SourceLocation::ReadVal(D);
- QualType T = QualType::ReadVal(D);
- ObjCIvarRefExpr* dr = new ObjCIvarRefExpr(NULL,T,Loc);
- D.ReadPtr(dr->D,false);
- return dr;
-}
-
-void ObjCPropertyRefExpr::EmitImpl(Serializer& S) const {
- S.Emit(IdLoc);
- S.Emit(getType());
- S.EmitPtr(getProperty());
-}
-
-void ObjCKVCRefExpr::EmitImpl(Serializer& S) const {
- S.Emit(Loc);
- S.Emit(getType());
- S.EmitPtr(getGetterMethod());
- S.EmitPtr(getSetterMethod());
-}
-
-ObjCPropertyRefExpr* ObjCPropertyRefExpr::CreateImpl(Deserializer& D,
- ASTContext& C) {
- SourceLocation Loc = SourceLocation::ReadVal(D);
- QualType T = QualType::ReadVal(D);
- ObjCPropertyRefExpr* dr = new ObjCPropertyRefExpr(NULL,T,Loc,0);
- D.ReadPtr(dr->AsProperty,false);
- return dr;
-}
-
-ObjCKVCRefExpr* ObjCKVCRefExpr::CreateImpl(Deserializer& D,
- ASTContext& C) {
- SourceLocation Loc = SourceLocation::ReadVal(D);
- QualType T = QualType::ReadVal(D);
- ObjCKVCRefExpr* dr = new ObjCKVCRefExpr(NULL,T,NULL,Loc,0);
- D.ReadPtr(dr->Setter,false);
- D.ReadPtr(dr->Getter,false);
- return dr;
-}
-
-void ObjCMessageExpr::EmitImpl(Serializer& S) const {
- S.EmitInt(getFlag());
- S.Emit(getType());
- S.Emit(SelName);
- S.Emit(LBracloc);
- S.Emit(RBracloc);
- S.EmitInt(NumArgs);
- S.EmitPtr(MethodProto);
-
- if (getReceiver())
- S.BatchEmitOwnedPtrs(NumArgs+1, SubExprs);
- else {
- ClassInfo Info = getClassInfo();
-
- if (Info.first) S.EmitPtr(Info.first);
- else S.EmitPtr(Info.second);
-
- S.BatchEmitOwnedPtrs(NumArgs, &SubExprs[ARGS_START]);
- }
-}
-
-ObjCMessageExpr* ObjCMessageExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- unsigned flags = D.ReadInt();
- QualType t = QualType::ReadVal(D);
- Selector S = Selector::ReadVal(D);
- SourceLocation L = SourceLocation::ReadVal(D);
- SourceLocation R = SourceLocation::ReadVal(D);
-
- // Construct an array for the subexpressions.
- unsigned NumArgs = D.ReadInt();
- Stmt** SubExprs = new Stmt*[NumArgs+1];
-
- // Construct the ObjCMessageExpr object using the special ctor.
- ObjCMessageExpr* ME = new ObjCMessageExpr(S, t, L, R, SubExprs, NumArgs);
-
- // Read in the MethodProto. Read the instance variable directly
- // allows it to be backpatched.
- D.ReadPtr(ME->MethodProto);
-
- // Now read in the arguments.
-
- if ((flags & Flags) == IsInstMeth)
- D.BatchReadOwnedPtrs(NumArgs+1, SubExprs, C);
- else {
- // Read the pointer for Cls/ClassName. The Deserializer will handle the
- // bit-mangling automatically.
- SubExprs[RECEIVER] = (Stmt*) ((uintptr_t) flags);
- D.ReadUIntPtr((uintptr_t&) SubExprs[RECEIVER]);
-
- // Read the arguments.
- D.BatchReadOwnedPtrs(NumArgs, &SubExprs[ARGS_START], C);
- }
-
- return ME;
-}
-
-void ObjCSelectorExpr::EmitImpl(Serializer& S) const {
- S.Emit(AtLoc);
- S.Emit(RParenLoc);
- S.Emit(getType());
- S.Emit(SelName);
-}
-
-ObjCSelectorExpr* ObjCSelectorExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation AtLoc = SourceLocation::ReadVal(D);
- SourceLocation RParenLoc = SourceLocation::ReadVal(D);
- QualType T = QualType::ReadVal(D);
- Selector SelName = Selector::ReadVal(D);
-
- return new ObjCSelectorExpr(T,SelName,AtLoc,RParenLoc);
-}
-
-void ObjCStringLiteral::EmitImpl(Serializer& S) const {
- S.Emit(AtLoc);
- S.Emit(getType());
- S.EmitOwnedPtr(String);
-}
-
-ObjCStringLiteral* ObjCStringLiteral::CreateImpl(Deserializer& D, ASTContext& C) {
- SourceLocation L = SourceLocation::ReadVal(D);
- QualType T = QualType::ReadVal(D);
- StringLiteral* String = cast<StringLiteral>(D.ReadOwnedPtr<Stmt>(C));
- return new ObjCStringLiteral(String,T,L);
-}
-
-void ObjCSuperExpr::EmitImpl(llvm::Serializer& S) const {
- S.Emit(getType());
- S.Emit(Loc);
-}
-
-ObjCSuperExpr* ObjCSuperExpr::CreateImpl(llvm::Deserializer& D, ASTContext&) {
- QualType Ty = QualType::ReadVal(D);
- SourceLocation Loc = SourceLocation::ReadVal(D);
- return new ObjCSuperExpr(Loc, Ty);
-}
-
-//===----------------------------------------------------------------------===//
-// Serialization for Clang Extensions.
-//===----------------------------------------------------------------------===//
-
-void ExtVectorElementExpr::EmitImpl(llvm::Serializer& S) const {
- S.Emit(getType());
- S.EmitOwnedPtr(getBase());
- S.EmitPtr(&Accessor);
- S.Emit(AccessorLoc);
-}
-
-ExtVectorElementExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C) {
- QualType T = QualType::ReadVal(D);
- Expr *B = D.ReadOwnedPtr<Expr>(C);
- IdentifierInfo *A = D.ReadPtr<IdentifierInfo>();
- SourceLocation AL = SourceLocation::ReadVal(D);
- return new (C) ExtVectorElementExpr(T, B, *A, AL);
-}
-
-void BlockExpr::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.EmitOwnedPtr(TheBlock);
- S.EmitBool(HasBlockDeclRefExprs);
-}
-
-BlockExpr* BlockExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType T = QualType::ReadVal(D);
- BlockDecl *B = cast<BlockDecl>(D.ReadOwnedPtr<Decl>(C));
- bool H = D.ReadBool();
- return new BlockExpr(B,T,H);
-}
-
-void BlockDeclRefExpr::EmitImpl(Serializer& S) const {
- S.Emit(Loc);
- S.Emit(getType());
- S.EmitBool(false);
- S.EmitPtr(getDecl());
-}
-
-BlockDeclRefExpr* BlockDeclRefExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- assert(0 && "Cannot deserialize BlockDeclRefExpr yet");
- return 0;
-}
-
-//===----------------------------------------------------------------------===//
-// C++ Serialization
-//===----------------------------------------------------------------------===//
-void CXXDefaultArgExpr::EmitImpl(Serializer& S) const {
- S.EmitPtr(Param);
-}
-
-CXXDefaultArgExpr *CXXDefaultArgExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- ParmVarDecl* Param = 0;
- D.ReadPtr(Param, false);
- return new CXXDefaultArgExpr(Param);
-}
-
-void CXXFunctionalCastExpr::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.Emit(getTypeAsWritten());
- S.Emit(TyBeginLoc);
- S.Emit(RParenLoc);
- S.EmitOwnedPtr(getSubExpr());
-}
-
-CXXFunctionalCastExpr *
-CXXFunctionalCastExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType Ty = QualType::ReadVal(D);
- QualType WrittenTy = QualType::ReadVal(D);
- SourceLocation TyBeginLoc = SourceLocation::ReadVal(D);
- SourceLocation RParenLoc = SourceLocation::ReadVal(D);
- Expr* SubExpr = D.ReadOwnedPtr<Expr>(C);
- return new CXXFunctionalCastExpr(Ty, WrittenTy, TyBeginLoc, SubExpr, RParenLoc);
-}
-
-void CXXNamedCastExpr::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.Emit(getTypeAsWritten());
- S.Emit(Loc);
- S.EmitOwnedPtr(getSubExpr());
-}
-
-CXXNamedCastExpr *
-CXXNamedCastExpr::CreateImpl(Deserializer& D, ASTContext& C, StmtClass SC) {
- QualType Ty = QualType::ReadVal(D);
- QualType WrittenTy = QualType::ReadVal(D);
- SourceLocation Loc = SourceLocation::ReadVal(D);
- Expr* SubExpr = D.ReadOwnedPtr<Expr>(C);
- switch (SC) {
- case CXXStaticCastExprClass:
- return new CXXStaticCastExpr(Ty, SubExpr, WrittenTy, Loc);
- case CXXDynamicCastExprClass:
- return new CXXDynamicCastExpr(Ty, SubExpr, WrittenTy, Loc);
- case CXXReinterpretCastExprClass:
- return new CXXReinterpretCastExpr(Ty, SubExpr, WrittenTy, Loc);
- case CXXConstCastExprClass:
- return new CXXConstCastExpr(Ty, SubExpr, WrittenTy, Loc);
- default:
- assert(false && "Unknown cast type!");
- return 0;
- }
-}
-
-void CXXTypeidExpr::EmitImpl(llvm::Serializer& S) const {
- S.Emit(getType());
- S.EmitBool(isTypeOperand());
- if (isTypeOperand()) {
- S.Emit(getTypeOperand());
- } else {
- S.EmitOwnedPtr(getExprOperand());
- }
- S.Emit(Range);
-}
-
-CXXTypeidExpr*
-CXXTypeidExpr::CreateImpl(llvm::Deserializer& D, ASTContext& C) {
- QualType Ty = QualType::ReadVal(D);
- bool isTypeOp = D.ReadBool();
- void *Operand;
- if (isTypeOp) {
- Operand = QualType::ReadVal(D).getAsOpaquePtr();
- } else {
- Operand = D.ReadOwnedPtr<Expr>(C);
- }
- SourceRange Range = SourceRange::ReadVal(D);
- return new CXXTypeidExpr(isTypeOp, Operand, Ty, Range);
-}
-
-void CXXThisExpr::EmitImpl(llvm::Serializer& S) const {
- S.Emit(getType());
- S.Emit(Loc);
-}
-
-CXXThisExpr* CXXThisExpr::CreateImpl(llvm::Deserializer& D, ASTContext&) {
- QualType Ty = QualType::ReadVal(D);
- SourceLocation Loc = SourceLocation::ReadVal(D);
- return new CXXThisExpr(Loc, Ty);
-}
-
-void CXXTemporaryObjectExpr::EmitImpl(llvm::Serializer& S) const {
- S.Emit(getType());
- S.Emit(TyBeginLoc);
- S.Emit(RParenLoc);
- S.EmitPtr(cast<Decl>(Constructor));
- S.EmitInt(NumArgs);
- if (NumArgs > 0)
- S.BatchEmitOwnedPtrs(NumArgs, Args);
-}
-
-CXXTemporaryObjectExpr *
-CXXTemporaryObjectExpr::CreateImpl(llvm::Deserializer& D, ASTContext& C) {
- QualType writtenTy = QualType::ReadVal(D);
- SourceLocation tyBeginLoc = SourceLocation::ReadVal(D);
- SourceLocation rParenLoc = SourceLocation::ReadVal(D);
- CXXConstructorDecl * Cons = cast_or_null<CXXConstructorDecl>(D.ReadPtr<Decl>());
- unsigned NumArgs = D.ReadInt();
- Stmt** Args = 0;
- if (NumArgs > 0) {
- Args = new Stmt*[NumArgs];
- D.BatchReadOwnedPtrs(NumArgs, Args, C);
- }
-
- CXXTemporaryObjectExpr * Result
- = new CXXTemporaryObjectExpr(Cons, writtenTy, tyBeginLoc,
- (Expr**)Args, NumArgs, rParenLoc);
-
- if (NumArgs > 0)
- delete [] Args;
-
- return Result;
-}
-
-
-void CXXZeroInitValueExpr::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.Emit(TyBeginLoc);
- S.Emit(RParenLoc);
-}
-
-CXXZeroInitValueExpr *
-CXXZeroInitValueExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType Ty = QualType::ReadVal(D);
- SourceLocation TyBeginLoc = SourceLocation::ReadVal(D);
- SourceLocation RParenLoc = SourceLocation::ReadVal(D);
- return new CXXZeroInitValueExpr(Ty, TyBeginLoc, RParenLoc);
-}
-
-void CXXNewExpr::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.EmitBool(GlobalNew);
- S.EmitBool(ParenTypeId);
- S.EmitBool(Initializer);
- S.EmitBool(Array);
- S.EmitInt(NumPlacementArgs);
- S.EmitInt(NumConstructorArgs);
- S.BatchEmitOwnedPtrs(NumPlacementArgs + NumConstructorArgs, SubExprs);
- assert((OperatorNew == 0 || S.isRegistered(OperatorNew)) &&
- (OperatorDelete == 0 || S.isRegistered(OperatorDelete)) &&
- (Constructor == 0 || S.isRegistered(Constructor)) &&
- "CXXNewExpr cannot own declarations");
- S.EmitPtr(OperatorNew);
- S.EmitPtr(OperatorDelete);
- S.EmitPtr(Constructor);
- S.Emit(StartLoc);
- S.Emit(EndLoc);
-}
-
-CXXNewExpr *
-CXXNewExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType T = QualType::ReadVal(D);
- bool GlobalNew = D.ReadBool();
- bool ParenTypeId = D.ReadBool();
- bool Initializer = D.ReadBool();
- bool Array = D.ReadBool();
- unsigned NumPlacementArgs = D.ReadInt();
- unsigned NumConstructorArgs = D.ReadInt();
- unsigned TotalExprs = Array + NumPlacementArgs + NumConstructorArgs;
- Stmt** SubExprs = new Stmt*[TotalExprs];
- D.BatchReadOwnedPtrs(TotalExprs, SubExprs, C);
- FunctionDecl *OperatorNew = D.ReadPtr<FunctionDecl>();
- FunctionDecl *OperatorDelete = D.ReadPtr<FunctionDecl>();
- CXXConstructorDecl *Constructor = D.ReadPtr<CXXConstructorDecl>();
- SourceLocation StartLoc = SourceLocation::ReadVal(D);
- SourceLocation EndLoc = SourceLocation::ReadVal(D);
-
- return new CXXNewExpr(T, GlobalNew, ParenTypeId, Initializer, Array,
- NumPlacementArgs, NumConstructorArgs, SubExprs,
- OperatorNew, OperatorDelete, Constructor, StartLoc,
- EndLoc);
-}
-
-void CXXDeleteExpr::EmitImpl(Serializer& S) const {
- S.Emit(getType());
- S.EmitBool(GlobalDelete);
- S.EmitBool(ArrayForm);
- S.EmitPtr(OperatorDelete);
- S.EmitOwnedPtr(Argument);
- S.Emit(Loc);
-}
-
-CXXDeleteExpr *
-CXXDeleteExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- QualType Ty = QualType::ReadVal(D);
- bool GlobalDelete = D.ReadBool();
- bool ArrayForm = D.ReadBool();
- FunctionDecl *OperatorDelete = D.ReadPtr<FunctionDecl>();
- Stmt *Argument = D.ReadOwnedPtr<Stmt>(C);
- SourceLocation Loc = SourceLocation::ReadVal(D);
- return new CXXDeleteExpr(Ty, GlobalDelete, ArrayForm, OperatorDelete,
- cast<Expr>(Argument), Loc);
-}
-
-void UnresolvedFunctionNameExpr::EmitImpl(llvm::Serializer& S) const {
- S.Emit(getType());
- S.EmitPtr(Name.getAsIdentifierInfo()); // FIXME: WRONG!
- S.Emit(Loc);
-}
-
-UnresolvedFunctionNameExpr *
-UnresolvedFunctionNameExpr::CreateImpl(llvm::Deserializer& D, ASTContext& C) {
- QualType Ty = QualType::ReadVal(D);
- IdentifierInfo *N = D.ReadPtr<IdentifierInfo>();
- SourceLocation L = SourceLocation::ReadVal(D);
- return new UnresolvedFunctionNameExpr(N, Ty, L);
-}
-
-void UnaryTypeTraitExpr::EmitImpl(llvm::Serializer& S) const {
- S.EmitInt(UTT);
- S.Emit(Loc);
- S.Emit(RParen);
- S.Emit(QueriedType);
- S.Emit(getType());
-}
-
-UnaryTypeTraitExpr *
-UnaryTypeTraitExpr::CreateImpl(llvm::Deserializer& D, ASTContext& C) {
- UnaryTypeTrait UTT = static_cast<UnaryTypeTrait>(D.ReadInt());
- SourceLocation Loc = SourceLocation::ReadVal(D);
- SourceLocation RParen = SourceLocation::ReadVal(D);
- QualType QueriedType = QualType::ReadVal(D);
- QualType Ty = QualType::ReadVal(D);
- return new UnaryTypeTraitExpr(Loc, UTT, QueriedType, RParen, Ty);
-}
-
-void CXXCatchStmt::EmitImpl(llvm::Serializer& S) const {
- S.Emit(CatchLoc);
- S.EmitOwnedPtr(ExceptionDecl);
- S.EmitOwnedPtr(HandlerBlock);
-}
-
-CXXCatchStmt *
-CXXCatchStmt::CreateImpl(llvm::Deserializer& D, ASTContext& C) {
- SourceLocation CatchLoc = SourceLocation::ReadVal(D);
- Decl *ExDecl = D.ReadOwnedPtr<Decl>(C);
- Stmt *HandlerBlock = D.ReadOwnedPtr<Stmt>(C);
- return new CXXCatchStmt(CatchLoc, ExDecl, HandlerBlock);
-}
-
-void CXXTryStmt::EmitImpl(llvm::Serializer& S) const {
- S.Emit(TryLoc);
- S.EmitInt(Stmts.size());
- S.BatchEmitOwnedPtrs(Stmts.size(), &Stmts[0]);
-}
-
-CXXTryStmt *
-CXXTryStmt::CreateImpl(llvm::Deserializer& D, ASTContext& C) {
- SourceLocation TryLoc = SourceLocation::ReadVal(D);
- unsigned size = D.ReadInt();
- llvm::SmallVector<Stmt*, 4> Stmts(size);
- D.BatchReadOwnedPtrs<Stmt>(size, &Stmts[0], C);
-
- return new CXXTryStmt(TryLoc, Stmts[0], &Stmts[1], size - 1);
-}
-
-void QualifiedDeclRefExpr::EmitImpl(llvm::Serializer& S) const {
- DeclRefExpr::EmitImpl(S);
- S.Emit(QualifierRange);
- // FIXME: Serialize nested-name-specifiers
-}
-
-QualifiedDeclRefExpr*
-QualifiedDeclRefExpr::CreateImpl(llvm::Deserializer& D, ASTContext& C) {
- assert(false && "Cannot deserialize qualified decl references");
- return 0;
-}
Removed: cfe/trunk/lib/AST/TypeSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypeSerialization.cpp?rev=69827&view=auto
==============================================================================
--- cfe/trunk/lib/AST/TypeSerialization.cpp (original)
+++ cfe/trunk/lib/AST/TypeSerialization.cpp (removed)
@@ -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();
-}
Modified: cfe/trunk/lib/Basic/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/CMakeLists.txt?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/CMakeLists.txt (original)
+++ cfe/trunk/lib/Basic/CMakeLists.txt Wed Apr 22 16:45:53 2009
@@ -5,7 +5,6 @@
Diagnostic.cpp
FileManager.cpp
IdentifierTable.cpp
- LangOptions.cpp
SourceLocation.cpp
SourceManager.cpp
TargetInfo.cpp
Modified: cfe/trunk/lib/Basic/FileManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/FileManager.cpp (original)
+++ cfe/trunk/lib/Basic/FileManager.cpp Wed Apr 22 16:45:53 2009
@@ -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;
Modified: cfe/trunk/lib/Basic/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/IdentifierTable.cpp?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/IdentifierTable.cpp (original)
+++ cfe/trunk/lib/Basic/IdentifierTable.cpp Wed Apr 22 16:45:53 2009
@@ -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 @@
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 @@
/// 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 @@
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;
-}
Removed: cfe/trunk/lib/Basic/LangOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/LangOptions.cpp?rev=69827&view=auto
==============================================================================
--- cfe/trunk/lib/Basic/LangOptions.cpp (original)
+++ cfe/trunk/lib/Basic/LangOptions.cpp (removed)
@@ -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;
-}
Modified: cfe/trunk/lib/Basic/SourceLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceLocation.cpp?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceLocation.cpp (original)
+++ cfe/trunk/lib/Basic/SourceLocation.cpp Wed Apr 22 16:45:53 2009
@@ -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 @@
// 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 @@
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
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Wed Apr 22 16:45:53 2009
@@ -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 @@
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;
-}
Modified: cfe/trunk/tools/clang-cc/ASTConsumers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/ASTConsumers.cpp?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/ASTConsumers.cpp (original)
+++ cfe/trunk/tools/clang-cc/ASTConsumers.cpp Wed Apr 22 16:45:53 2009
@@ -1000,144 +1000,3 @@
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);
-}
Modified: cfe/trunk/tools/clang-cc/ASTConsumers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/ASTConsumers.h?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/ASTConsumers.h (original)
+++ cfe/trunk/tools/clang-cc/ASTConsumers.h Wed Apr 22 16:45:53 2009
@@ -61,13 +61,6 @@
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);
Modified: cfe/trunk/tools/clang-cc/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/CMakeLists.txt?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/CMakeLists.txt (original)
+++ cfe/trunk/tools/clang-cc/CMakeLists.txt Wed Apr 22 16:45:53 2009
@@ -37,6 +37,5 @@
RewriteMacros.cpp
RewriteObjC.cpp
RewriteTest.cpp
- SerializationTest.cpp
Warnings.cpp
)
Removed: cfe/trunk/tools/clang-cc/SerializationTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/SerializationTest.cpp?rev=69827&view=auto
==============================================================================
--- cfe/trunk/tools/clang-cc/SerializationTest.cpp (original)
+++ cfe/trunk/tools/clang-cc/SerializationTest.cpp (removed)
@@ -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";
-}
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=69828&r1=69827&r2=69828&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Wed Apr 22 16:45:53 2009
@@ -180,13 +180,11 @@
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 @@
"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 @@
"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 @@
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 @@
case InheritanceView:
return CreateInheritanceViewer(InheritanceViewCls);
- case TestSerialization:
- return CreateSerializationTest(Diag, FileMgr);
-
case EmitAssembly:
case EmitLLVM:
case EmitBC:
@@ -1582,12 +1573,7 @@
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 @@
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 @@
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)
More information about the cfe-commits
mailing list