/// Default argument, if any. [C++ Only]
Expr *DefaultArg;
-
+protected:
ParmVarDecl(DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, QualType T, StorageClass S,
Expr *DefArg, ScopedDecl *PrevDecl)
friend Decl* Decl::Create(llvm::Deserializer& D, ASTContext& C);
};
+/// ParmVarWithOriginalTypeDecl - Represent a parameter to a function, when
+/// the type of the parameter has been promoted. This node represents the
+/// parameter to the function with its original type.
+///
+class ParmVarWithOriginalTypeDecl : public ParmVarDecl {
+private:
+ QualType OriginalType;
+
+ ParmVarWithOriginalTypeDecl(DeclContext *DC, SourceLocation L,
+ IdentifierInfo *Id, QualType T,
+ QualType OT, StorageClass S,
+ Expr *DefArg, ScopedDecl *PrevDecl)
+ : ParmVarDecl(DC, L, Id, T, S, DefArg, PrevDecl), OriginalType(OT) {}
+public:
+ static ParmVarWithOriginalTypeDecl *Create(ASTContext &C, DeclContext *DC,
+ SourceLocation L,IdentifierInfo *Id,
+ QualType T, QualType OT,
+ StorageClass S, Expr *DefArg,
+ ScopedDecl *PrevDecl);
+ QualType getQualType() const { return OriginalType; }
+
+ // Implement isa/cast/dyncast/etc.
+ static bool classof(const Decl *D) { return D->getKind() == OriginalParmVar; }
+ static bool classof(const ParmVarWithOriginalTypeDecl *D) { return true; }
+
+protected:
+ /// EmitImpl - Serialize this ParmVarWithOriginalTypeDecl.
+ /// Called by Decl::Emit.
+ virtual void EmitImpl(llvm::Serializer& S) const;
+
+ /// CreateImpl - Deserialize a ParmVarWithOriginalTypeDecl.
+ /// Called by Decl::Create.
+ static ParmVarWithOriginalTypeDecl* 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
/// function declaration or definition.
///
return new (Mem) ParmVarDecl(DC, L, Id, T, S, DefArg, PrevDecl);
}
+ParmVarWithOriginalTypeDecl *ParmVarWithOriginalTypeDecl::Create(
+ ASTContext &C, DeclContext *DC,
+ SourceLocation L, IdentifierInfo *Id,
+ QualType T, QualType OT, StorageClass S,
+ Expr *DefArg, ScopedDecl *PrevDecl) {
+ void *Mem = C.getAllocator().Allocate<ParmVarWithOriginalTypeDecl>();
+ return new (Mem) ParmVarWithOriginalTypeDecl(DC, L, Id, T, OT, S,
+ DefArg, PrevDecl);
+}
+
FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
DeclarationName N, QualType T,
Dcl = ParmVarDecl::CreateImpl(D, C);
break;
+ case OriginalParmVar:
+ Dcl = ParmVarWithOriginalTypeDecl::CreateImpl(D, C);
+ break;
+
case Function:
Dcl = FunctionDecl::CreateImpl(D, C);
break;
return decl;
}
+//===----------------------------------------------------------------------===//
+// ParmVarWithOriginalTypeDecl Serialization.
+//===----------------------------------------------------------------------===//
+
+void ParmVarWithOriginalTypeDecl::EmitImpl(llvm::Serializer& S) const {
+ ParmVarDecl::EmitImpl(S);
+ S.Emit(OriginalType);
+}
+
+ParmVarWithOriginalTypeDecl* ParmVarWithOriginalTypeDecl::CreateImpl(
+ Deserializer& D, ASTContext& C) {
+ void *Mem = C.getAllocator().Allocate<ParmVarWithOriginalTypeDecl>();
+ ParmVarWithOriginalTypeDecl* decl = new (Mem)
+ ParmVarWithOriginalTypeDecl(0, SourceLocation(), NULL, QualType(),
+ QualType(), None, NULL, NULL);
+
+ decl->ParmVarDecl::ReadImpl(D, C);
+ decl->OriginalType = QualType::ReadVal(D);
+ return decl;
+}
//===----------------------------------------------------------------------===//
// EnumDecl Serialization.
//===----------------------------------------------------------------------===//